gauss.sty 和 \mathsurround

gauss.sty 和 \mathsurround

使用 会\mathsurround<>0破坏加号附近第一行和第二行之间的连线。在 处可以看到这种情况\mathsurround1pt,在这里甚至更加严重:

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

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

除了避免之外还有其他治疗方法吗\mathsurround<>0

答案1

不幸的是,gauss.sty设置内部数学时没有采取预防措施,\mathsurround应该将其设置为零。

这是一个快速的解决方法:

\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}

答案2

根据你想要的效果,你只需要添加\m@th到本地重置 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
 \global\advance\g@arrowht\dp\g@trash
 \global\advance\g@arrowht\lineskip
 % 4. What should be the thickness of ordinary lines?
 \global\g@linethickness=\fboxrule\relax
}

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

\end{document}

相关内容