Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

What I'm looking to do is caption a graph with something like

"It can be seen from x (solid line) and y (dashed line)"

Where "solid line" and "dashed line" are replaced by two solid and dashed lines centered vertically inline with the text of the caption.

Using

\protect\rule{1cm}{.4pt}

Gives a solid line, but it is not centered with respect to the height of the text.

Is this possible?

share|improve this question

2 Answers 2

up vote 9 down vote accepted

The rule command has a "raise" optional argument:

\rule[0.5ex]{1cm}{0.4pt}

You can define

\newcommand\solidrule[1][1cm]{\rule[0.5ex]{#1}{.4pt}}
\newcommand\dashedrule{\mbox{%
  \solidrule[2mm]\hspace{2mm}\solidrule[2mm]\hspace{2mm}\solidrule[2mm]}}

and then use

It can be seen from x (\solidrule) and y (\protect\dashedrule)
share|improve this answer

shift the rule with the optional argument:

\rule[0.6ex]{1cm}{.4pt}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.