# gauss.sty and \mathsurround

The use of \mathsurround<>0 corrupts the line joining the first and second row near the plus-sign. It's visible at \mathsurround1pt, and even more drastically here:

\documentclass{article}
\usepackage{gauss}
\mathsurround10pt
\begin{document}

$\begin{gmatrix} 1 & 2 \\ 3 & 4 \rowops \add{0}{1} \end{gmatrix}$
\end{document}


Is there any cure besides avoiding \mathsurround<>0?

• Avoid gauss.sty? Set \fboxrule=0pt? – John Kormylo Dec 12 '16 at 14:35
• Are you referring to a custom version of gauss.sty, and not the one by Manuel Kauers that is found on CTAN? – Torbjørn T. Dec 12 '16 at 14:44
• Sorry, it's the one from CTAN by Manuel. – Michael Hoppe Dec 12 '16 at 15:08

Unfortunately, gauss.sty doesn't take precautions when setting inner math, where \mathsurround should be set to zero.

Here's a quick workaround:

\documentclass{article}
\usepackage{gauss}
\usepackage{etoolbox}
\AtBeginEnvironment{gmatrix}{\setlength{\mathsurround}{0pt}}

\setlength{mathsurround}{10pt}

\begin{document}
$\begin{gmatrix} 1 & 2 \\ 3 & 4 \rowops \add{0}{1} \end{gmatrix}$
\end{document}


Depending what effect you want you just need to add \m@th to locally reset mathsurround,

\documentclass{article}
\usepackage{gauss}

\begin{document}

$\begin{gmatrix} 1 & 2 \\ 3 & 4 \rowops \add{0}{1} \end{gmatrix}$

\makeatletter
\def\g@vertline{\hbox{$\m@th\g@vertlineSymb$}\kern-\lineskip}%
\def\colmultlabel#1{%
\underline{\hbox to 1.2em{$\m@th\hss\mathstrut{}#1\hss$}}%
}
\def\g@downarrow#1{\vbox{%
\vfill
\baselineskip\z@\relax
\g@d@tmpc=#1\relax
\ifdim \g@d@tmpc<\g@arrowht
\g@d@tmpc\g@arrowht\relax
\fi
\g@vlineRec
\kern\g@d@tmpc
\setbox\g@trash=\hbox{$\m@th\g@downarrowSymb$}%
\hbox{\raise\dp\g@trash\box\g@trash}%
}}
\def\g@rbox#1#2#3{%
\setbox\g@label=\hbox{$\m@th\relax#3\relax$}%
\ht\g@label\z@\dp\g@label\z@
\setbox\g@label=\hbox{$\m@th\mathstrut\box\g@label$}%
\put(\g@double{#1},\g@double{#2})%
{\makebox(0,0)[l]{\kern-\p@\copy\g@label}}%
}
\def\g@cbox#1#2#3{%
\setbox\g@label=\hbox{$\m@th\relax#3\relax$}%
\setbox\g@label=\hbox{\raise\dp\g@label\box\g@label}%
\put(\g@double{#1},\g@double{#2})%
{\makebox(0,0)[b]{\copy\g@label}}%
}
\def\colmultlabel#1{%
\underline{\hbox to 1.2em{$\m@th\hss\mathstrut{}#1\hss$}}%
}

\mathsurround10pt
$\begin{gmatrix} 1 & 2 \\ 3 & 4 \rowops \add{0}{1} \end{gmatrix}$

\def\g@measureAxis{%
% 1. Where is the math axis relative to the ground line?
\setbox\g@trash=\hbox{$\m@th\vcenter{\hbox to 5pt{}}$}%
\global\g@axisHeight=\ht\g@trash
% 2. What is the minimum width of a horizontal arrow?
\setbox\g@trash=\hbox{$\m@th\leftarrow$}%
\global\g@arrowwd\wd\g@trash
% 3. What is the minimum height of a vertical arrow?
\setbox\g@trash=\vbox{\g@vertline}%
\global\g@arrowht=\ht\g@trash
$\begin{gmatrix} 1 & 2 \\ 3 & 4 \rowops \add{0}{1} \end{gmatrix}$