dryabov / rmathbr

Repeating of math hyphenation mark in inline equations
http://d-ryabov.livejournal.com/723.html
8 stars 0 forks source link

Bug/incompatibility: using rmathbr with package `gauss` for writing matrix operations #10

Open typomaster2 opened 1 year ago

typomaster2 commented 1 year ago

There seems to be an incompatibility with the package gauss. The package gauss is used to typeset, among other things, elementary operations on matrices. This includes arrows spanning multiple lines or columns which is not available with nicematrix for instance.

Consider the following example code (here package rmathbr is commented out):

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{gauss}

%\usepackage{rmathbr}

\newmatrix{|\;}{]}{vb}
\newmatrix{[}{.\,}{lb}
\setlength\rowarrowsep{-3pt}

\begin{document}
    \[ \begin{gmatrix}[lb]
        0 & 1 & 2 \\
        1 & 2 & 1 \\
        2 & 1 & 3 \end{gmatrix} 
    \begin{gmatrix}[vb]
        0 \\
        0 \\
        0
        \rowops\swap{0}{1}
    \end{gmatrix} \]
\end{document}

This yields the expected output: Expected output

However, if rmathbr is active, then the following errors appear:

! Missing { inserted.
<to be read again> 
                   \def 
l.21        \rowops\swap{0}{1}

A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
(If you're confused by all this, try typing `I}' now.)

! Missing } inserted.
<inserted text> 
                }
l.21        \rowops\swap{0}{1}

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

Overfull \hbox (1.33345pt too wide) detected at line 21
$[]$
 []

! Missing { inserted.
<to be read again> 
                   \def 
l.21        \rowops\swap{0}{1}

A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
(If you're confused by all this, try typing `I}' now.)

! Missing } inserted.
<inserted text> 
                }
l.21        \rowops\swap{0}{1}

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

Overfull \hbox (1.33345pt too wide) detected at line 21
$[]$
 []

Verified with my local distribution (everything updated via MikTeX today) and Overleaf (including most recent version of rmathbr). Errors quoted from and pictured made on Overleaf

dryabov commented 1 year ago

You can use

\makeatletter\AddToHook{env/g@matrix/begin}{\rmathbr@unsetbrokens}\makeatother

as a workaround (but I'm not sure there is a simpler solution).

typomaster2 commented 1 year ago

Thank you very much. The solution suggested in your prompt reply works great. Please close / leave open this issue as you best see fit. Thanks again!