[OS X TeX] Filling the box in a table

Ross Moore ross at ics.mq.edu.au
Tue Aug 8 23:02:19 EDT 2006


Hi Alain,

On 09/08/2006, at 10:59 AM, Alain Schremmer wrote:

> In the following:
>
>    Please indicate your choices with an \textsf{{\Large X}} as  
> follows:
>    \newdimen\digitwidth \settowidth\digitwidth{0}
>
>        \def~{\hspace{\digitwidth}}
>        \def\divrule#1#2{\noalign{\moveright#1\digitwidth\vbox{\hrule
>        width#2\digitwidth}}}
>        \catcode`\?=\active \def?{}

You don't actually use any of these definitions ...

>        \hspace*{-3mm}%
>        \begin{tabular}{@{} |c| @{}}
>        \midrule
>        %Row0
>        \textsf{{\Large X}}
>        \\
>        \midrule
>        \end{tabular}

  ... and you need some package to define \midrule.
Besides, this seems like a very inelegant way to
draw a box. At the very least you'll need to kill
the column-separation width; e.g., via
   \setlength{\tabcolsep}{0pt}
*before* starting the table.


>
> the code does not quite do what I would like which is for the X to  
> "fill" the box (in a grid for entering choices for multiple choice  
> questions) as \Large increases the size of the box.

Here is much more direct TeX coding to do what I think
you want:

\newcommand{\checkedbox}[1]{{%
   \setbox0=\hbox{\kern-.02em\textsf{#1}\kern-.05em}\dp0=0pt%
   \setbox0=\hbox{\hsize=\wd0\vbox{\hrule\box0\hrule}}%
   \hbox{\dimen0=\ht0 \dimen2=\dp0\relax
     \vrule height\dimen0 depth\dimen2 width .5pt%
     \box0%
     \vrule height\dimen0 depth\dimen2 width .5pt%
    }}}

\checkedbox{\Large X}

\checkedbox{\Large Y}

\checkedbox{\Huge Y}

\checkedbox{\Huge W}



>
> I adapted thiS—which I don't understand—from something given to me  
> on this list once upon a time for something else but tinkering did  
> not result in the desired effect.

Hope this helps.

Cheers,

	Ross


>
> Hopeful regards
> --schremmer

------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia  2109                            fax: +61 +2 9850 8114
------------------------------------------------------------------------


------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the MacOSX-TeX mailing list