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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
 $\frac{18e-12}{10}=\rule{5cm}{1pt}$

gives

enter image description here

How do I get something that likes this enter image description here

Thanks.

share|improve this question
up vote 4 down vote accepted

Measure the expression and use \mathpalette in order to get the rule at the correct height.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\exprrule}[2]{%
  #1#2\mathpalette\addexprrule{#1}%
}

\newcommand{\addexprrule}[2]{%
  \sbox0{$#1#2$}%
  \rule[-\dimexpr\dp0+1pt]{5cm}{1pt}%
}

\begin{document}

$\exprrule{\frac{18e-12}{10}}{=}$
\begin{align*}
\exprrule{\frac{18e-12}{10}}{&=}
\\[1ex]
\exprrule{\frac{\dfrac{1}{5\mathstrut}}{\sqrt{\dfrac{1}{25}}}}{&=}
\\[1ex]
\exprrule{a+a}{&=}
\end{align*}

\end{document}

enter image description here

share|improve this answer

enter image description here

\documentclass{article}



\begin{document}


$\frac{18e-12}{10}=\rule{5cm}{1pt}$


$\frac{18e-12}{10}=\rule[-4pt]{5cm}{1pt}$

\end{document}
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.