Alignment and phantom

by Thales   Last Updated November 09, 2018 00:23 AM

The MWE shows in the result the alignment as I need it in the first step. My questions are:

  1. Now after the "1" there should appear again a "4", exactly beneath the "4" of the very first line. How can I do this?
  2. Is there a more elegant solution in general (so that question 1 can be solved more easily)?

    \documentclass{article}
    \usepackage{amsmath}
     \begin{document}
     \begin{equation*}
     \begin{aligned}
      &&\sqrt{05\;47\;56} = 2 \\
      &-&4\phantom{\sqrt{05\;47\;56}} \\
      &&\rule{1cm}{0.4pt} \phantom{\sqrt{05\;47}} \\
     &&1\phantom{\sqrt{05\;47\;56}}
     \end{aligned}
     \end{equation*}
     \end{document}
    
Tags : alignment


Answers 2


You can use \mathmakebox and array. In the first column, the radical is placed as if it had the width of the radical sign (and no vinculum).

\documentclass{article}
\usepackage{amsmath,mathtools,calc}

\begin{document}

\begin{equation*}
\setlength{\arraycolsep}{0pt}
\begin{array}{r r @{\;} r @{\;} r l}
\mathmakebox[\widthof{$\sqrt{\vphantom{0}}$}][l]{\sqrt{\phantom{05\;47\;56}}} &
    05 & 47 & 56 & {} = 2 \\
-&   4 \\
\cline{2-2}
 &   1
\end{array}
\end{equation*}

\end{document}

enter image description here

egreg
egreg
November 08, 2018 23:59 PM

How about this code?

\documentclass{article}
\usepackage{mathtools}

 \begin{document}

 \begin{align*}
 \sqrt{05\;47\;56} & = 2 \\
  -\enspace 4\phantom{\;47\;56} & \\[-3ex]
\rule{1.1cm}{0.4pt} \phantom{\;56} & \\[-1.5ex]
 1\mathrlap{\;4}\phantom{\;47\;56} &
 \end{align*}

 \end{document} 

enter image description here

Bernard
Bernard
November 09, 2018 00:17 AM

Related Questions





Table Header with vertically centered alignment

Updated May 27, 2017 08:23 AM

Define a custom align, and align* environment

Updated June 11, 2017 15:23 PM