Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Expanding dotted-line in math mode

16 views
Skip to first unread message

gentsquash

unread,
Dec 28, 2011, 1:28:27 AM12/28/11
to
Years ago, some kind c.t.t-er posted a macro like the following:

\newbox\nans
\setbox\nans\hbox{\lower8pt\hbox{$\m@th\mkern1.5mu . \mkern1.5mu
$}}
%
\def\droppeddotfill{\cleaders\hbox{\copy\nans}\hfill}
%
\newcommand\ansgrow{%
\raisebox{-8pt}%
{{\vrule width0.5pt height3pt}{\vrule width3pt height0.5pt}}%
{\droppeddotfill}%
\raisebox{-8pt}%
{{\vrule width3pt height0.5pt}{\vrule width0.5pt height3pt}}%
}

It creates a dotted line for an answer to be
written in. E.g

/--------------------------------------------------------\
Thus $x=${\ansgrow} and $x=${\ansgrow} and ...
\________________________________________________________/

However this \ansgrow doesn't expand within math mode. I'd like
a version that grows in math mode, e.g

/--------------------------------------------------------\
Vector $v=(\ansgrow,\ansgrow)$ and $x=\ansgrow$.
\________________________________________________________/

Prof. Jonathan LF King Mathematics dept, Univ. of Florida

KF Leong

unread,
Dec 29, 2011, 1:35:16 AM12/29/11
to
You need to escape the @ letter use in the macro with \makeatletter &
\makeatother pair:

\makeatletter% escape @ letter
\newbox\nans
\setbox\nans\hbox{\lower8pt\hbox{\m@th$\mkern1.5mu . \mkern1.5mu$}}
%
\def\droppeddotfill{\cleaders\hbox{\copy\nans}\hfill}
%
\newcommand\ansgrow{%
\raisebox{-8pt}%
{{\vrule width0.5pt height3pt}{\vrule width3pt height0.5pt}}%
{\droppeddotfill}%
\raisebox{-8pt}%
{{\vrule width3pt height0.5pt}{\vrule width0.5pt height3pt}}%
}
\makeatother% reset @ to default

HTH.
KF

gentsquash

unread,
Dec 29, 2011, 3:35:32 AM12/29/11
to
On Dec 29, 1:35 am, KF Leong <kfleong...@gmail.com> wrote:
> You need to escape the @ letter use in the macro with
> \makeatletter & \makeatother pair:

My macros are in a ".sty" file, which -I thought- did that
automatically. I appreciate your reply, but I don't believe
it addresses what I was asking.
Sincerely, -Gentsquash

Dan

unread,
Dec 31, 2011, 11:35:20 PM12/31/11
to
The glue created by \hfill only expands enough to fill the
container it is put in. This container must therefore have a
fixed size to fill. In your first example, the container is one
line of a paragraph. This has the fixed size \hsize. In the
math mode cases, the container is the math mode itself,
which has no fixed size and will only be as wide as it needs
to be. The only way out is as in the first example:

Vector $v=($\ansgrow,\ansgrow$)$ and $x={}$\ansgrow.

Alternatively, wrap these in containers of fixed size:

Vector $v=(\hbox to 6cm{\ansgrow,\ansgrow})$ and
$x=\hbox to 3cm{\ansgrow}$.


Dan
0 new messages