5

I am trying to underline a result within an equation environment. The result contains a Matrix. I use the ulem package with uline.

How can I add more space between my matrix and the line?

I tried ULdepth which did not change the space between my matrix and the line.

Code example:

\documentclass{scrartcl) 
\usepackage{mathtools} 
\usepackage{ulem} 
\setlength{\ULdepth}{20pt}

\begin{document} 
\begin{equation*} 
\uline{A \cdot B =%
\begin{bmatrix*}[r]
6 & -12 \\
14 & 4    
\end{bmatrix*}} 
\end{equation*}

\end{document}

Matrix with uline

Thank you very much!

3

You can always \addstackgap befor ethe \uline. Here, macrofied as

\Uline[<extra depth>]{<math content>}.

\documentclass{scrartcl}
\usepackage{mathtools,stackengine} 
\usepackage{ulem} 
\setlength{\ULdepth}{20pt}
\newcommand\Uline[2][3pt]{\uline{\ensurestackMath{\addstackgap[#1]{#2}}}}
\begin{document} 
\begin{equation*} 
\Uline{A \cdot B =%
\begin{bmatrix*}[r]
6 & -12 \\
14 & 4    
\end{bmatrix*}}\qquad
\Uline[6pt]{A \cdot B =%
\begin{bmatrix*}[r]
6 & -12 \\
14 & 4    
\end{bmatrix*}}
\end{equation*}
\end{document}

enter image description here

Note: the argument to \Uline will be set in \textstyle unless \displaystyle is explicitly invoked (though I could automate it, were it vital to the answer).

4
\documentclass{scrartcl}
\usepackage{mathtools} 
\usepackage{ulem} 
\setlength\ULdepth{20pt}
\begin{document} 
\begin{equation*} 
\uline{A \cdot B =
\begin{bmatrix*}[r]
        6 & -12 \\
        14 & 4    
\end{bmatrix*}\rule[-15pt]{0pt}{0pt}} 
\end{equation*}

\end{document}

enter image description here

1

The definition of \uline is

% ulem.sty, line 43:
\def\uline{\relax \ifmmode\expandafter\underline 
           \else \bgroup\expandafter\ULset\fi}

Thus you see that in math mode, the result is the same as for \underline.

\documentclass{scrartcl}

\usepackage{mathtools}
\usepackage{array,booktabs}

\begin{document}

\begin{equation*}
\begin{array}{@{}>{\displaystyle}c@{}}
A\cdot B=
  \begin{bmatrix*}[r]
  6 & -12 \\
  14 & 4
  \end{bmatrix*}
\\
\addlinespace[5pt]
\midrule
\end{array}
\end{equation*}

\end{document}

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.