In Japan, it is very common to underline an answer in a math exam sheet with this:

Enter image description here

(Usual underline plus two slashes at the end.) Can I find a macro for this in some package? If not, do I have to create it with TikZ?

I've tried \underline{45\tiny$_{\!/\!\!/}$}, but the result was not what I desired.

  • Are you familiar with the \underline macro? A comment up front: \underline does not add the two slashes. How important are these slashes?
    – Mico
    Jan 15 at 6:12
  • 2
    @Mico Sorry for the unimportance. But at least for Japanese, it is in a way useful.
    – Taro
    Jan 15 at 6:17

With TikZ you can create a macro for this purpose. For example:

\usepackage   {tikz}

{% <-- We don't need a space here
  \begin{tikzpicture}[baseline=(a.base),line width=0.1ex]
    \node[inner sep=0] (a) at (0,0) {$#1$};
    \draw (a.south west) -- ([xshift=1.5ex]a.south east);
    \foreach\i in {0,0.5}
      \draw ([xshift=\i ex,yshift=-0.5ex]a.south east) --++ (1ex,1ex);
  \end{tikzpicture}% <-- We don't need a space here either

\textbf{Problem.} The bottom of a ladder must be placed $3$ feet from a wall.  The ladder is $12$ feet long.  How far above the ground does the ladder touch the wall?

\textbf{Solution.} By the Pythagorean Theorem,
\[a^2=b^2+c^2\Longrightarrow b=\sqrt{a^2-b^2}=\sqrt{12^2-3^2}=\sqrt{135}=\mysol{3\sqrt{15}}.\]
So the ladder touches the wall \mysol{3\sqrt{15}} feet above the ground.

Note that if the solution will not be in math mode you must remove the $...$ inside the node in the macro.

enter image description here

  • 2
    +1: What is the foreach for? Jan 15 at 7:08
  • 3
    @Dr.ManuelKuehner To place two slash / but it's not necessary Jan 15 at 7:10
  • 2
    @Dr.ManuelKuehner, thanks!! And the foreach is for the two slashes. Probably unnecessary, I know XD. Jan 15 at 7:11

I think you don't need TikZ for this:


Ordinary answer: \myunder{45}

Answer with \verb|\cfrac|: \myunder{$\cfrac{44}{45}$}

enter image description here

  • Thanks. I tried \myunder{$\cfrac{44}{45}$} now and backslashes went to a weird position. Is it possible to tweak the code so that it can apply to this case too?
    – Taro
    Jan 15 at 7:10
  • 1
    @Taro Of course! I have generalized my answer, look at it now, thanks!
    – CarLaTeX
    Jan 15 at 7:22

You could do this way:


  % store the text so we can measure it
  % the underline will always be below the baseline
  % measure the double slash
  % do the job (assuming the underline is 0.4pt thick)
  % add the depth we smashed out


Some text \solution{$45$}


Some text \solution{$\dfrac{1}{2}$}


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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