1

rmathbr is a package enabling another convention of breaking inline equations if they run too long. Specifically, symbols are repeated on the new line (and kept on previous line). So, for instance, a = b is broken as on a = on the first line and = b continuing on the second line. The package was recently updated (December 2020).

  • Please consider using that newest version when attempting to answer the question; otherwise unexpected bugs may be present.

There is a macro called \SetBreakableRel in the rmathbr package to create compound symbols one would also like to break with duplication when necessary (see documentation). For example, to get a breakable example usage, one defines a new command \goesto as (in the document preamble)

\newcommand{\goesto}{\xrightarrow{n\to\infty}}
\SetBreakableRel{\goesto}

This works great as far as I am concerned (line is broken and symbol is duplicated):

$e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e$ gives

Example of how \goesto works

The problems begin when one tries to define new commands (which break and duplicate) that also take in variable arguments. For example, if instead of n and ∞ one wants to have variables #1 and #2, i.e

\newcommand{\goestoarg}[2]{\xrightarrow{#1\to#2}} %<-- this doesn't work
\SetBreakableRel{\goestoarg} %<-- this doesn't work

then this gives errors and does not work: for example, $\goestoarg{a}{b}$ just gives example of faulty output (this is the wrong symbol to begin with so I didn't attempt to see if it duplicates on line break). To show that the problem is likely from rmathbr: if one (only) comments out \SetBreakableRel{\goestoarg}, one has the expected output: works without rmathbr. But, of course, I want to have it uncommented to enforce line breaking with duplication for this relation \goestoarg.

  • Question: How does one define \goestoarg with two arguments so that it works properly with \SetBreakableRel?

I have also tried to put two #'s (that is, ## instead of #, see MWE below) to no avail.


Here is the code (with some additional packagages to hint at needed compatibility with other packages):

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[LGR,T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{titlesec}
\usepackage{rmathbr}
\usepackage[pdftex]{graphicx}
\usepackage{parskip}
\usepackage[a4paper]{geometry}

\newcommand{\goesto}{\xrightarrow{n\to\infty}} %works great
\SetBreakableRel{\goesto} %works great

%%%%% uncomment as necessary

%\newcommand{\goestoarg}[2]{\xrightarrow{#1\to#2}} %<-- this doesn't work
%\SetBreakableRel{\goestoarg} %<-- this doesn't work

%\newcommand{\Goestoarg}[2]{\xrightarrow{##1\to##2}} %<-- this also doesn't work
%\SetBreakableRel{\Goestoarg} %<-- this also doesn't work


\begin{document}


$e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e$

%$\goestoarg{a}{b}$ %<- does not work
%$\Goestoarg{a}{b}$ %<- also does not work


\end{document}

Here is the log file from when \goestoarg stuff (three lines: the definition, SetBreakableRel and usage $\goestoarg{a}{b}$) is uncommented. This is a subset of the entire log file; I narrowed it down to start when rmathbr is loaded because the 30 000 character limit was exceeded. The errors are just before TeX Memory usage output near the end of the log.

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/rmathbr\rmathbr.st
y
Package: rmathbr 2020/12/18 1.1.1 Repeating of math operator at the broken line
 and the new line in inline equations

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/generic/iftex\ifetex.sty
Package: ifetex 2019/10/25 v1.3 ifetex legacy package. Use iftex instead.
(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/generic/iftex\iftex.sty
Package: iftex 2020/03/06 v1.0d TeX engine tests
))
(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/generic/iftex\ifluatex.s
ty
Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.
)
(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/xkeyval\xkeyval.st
y
Package: xkeyval 2020/11/20 v2.8 package option processing (HA)

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/generic/xkeyval\xkeyval.
tex
(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/generic/xkeyval\xkvutils
.tex
\XKV@toks=\toks30
\XKV@tempa@toks=\toks31
)
\XKV@depth=\count271
File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
))
(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3kernel\expl3.sty
Package: expl3 2021-02-18 L3 programming layer (loader) 

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3backend\l3backen
d-pdftex.def
File: l3backend-pdftex.def 2021-03-18 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count272
\l__pdf_internal_box=\box51
)))
(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\graphicx.
sty
Package: graphicx 2020/09/09 v1.2b Enhanced LaTeX Graphics (DPC,SPQR)

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\graphics.
sty
Package: graphics 2020/08/30 v1.4c Standard LaTeX Graphics (DPC,SPQR)

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\trig.sty
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics-cfg\graph
ics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 105.

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics-def\pdfte
x.def
File: pdftex.def 2020/10/05 v1.2a Graphics/color driver for pdftex
))
\Gin@req@height=\dimen164
\Gin@req@width=\dimen165
)
(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/parskip\parskip.st
y
Package: parskip 2021-03-14 v2.0h non-zero parskip adjustments

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/kvoptions\kvoption
s.sty
Package: kvoptions 2020-10-07 v3.14 Key value format for package options (HO)

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/generic/ltxcmds\ltxcmds.
sty
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
)
(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/generic/kvsetkeys\kvsetk
eys.sty
Package: kvsetkeys 2019/12/15 v1.18 Key value parser (HO)
))
(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/etoolbox\etoolbox.
sty
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count273
))
(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/geometry\geometry.
sty
Package: geometry 2020/01/02 v5.9 Page Geometry

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/generic/iftex\ifvtex.sty
Package: ifvtex 2019/10/25 v1.7 ifvtex legacy package. Use iftex instead.
)
\Gm@cnth=\count274
\Gm@cntv=\count275
\c@Gm@tempcnt=\count276
\Gm@bindingoffset=\dimen166
\Gm@wd@mp=\dimen167
\Gm@odd@mp=\dimen168
\Gm@even@mp=\dimen169
\Gm@layoutwidth=\dimen170
\Gm@layoutheight=\dimen171
\Gm@layouthoffset=\dimen172
\Gm@layoutvoffset=\dimen173
\Gm@dimlist=\toks32

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/geometry\geometry.
cfg))
No file Test12.aux.
\openout1 = `Test12.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 27.
LaTeX Font Info:    ... okay on input line 27.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 27.
LaTeX Font Info:    ... okay on input line 27.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 27.
LaTeX Font Info:    ... okay on input line 27.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 27.
LaTeX Font Info:    ... okay on input line 27.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 27.
LaTeX Font Info:    ... okay on input line 27.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 27.
LaTeX Font Info:    ... okay on input line 27.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 27.
LaTeX Font Info:    ... okay on input line 27.
LaTeX Font Info:    Checking defaults for LGR/cmr/m/n on input line 27.
LaTeX Font Info:    Trying to load font information for LGR+cmr on input line 2
7.

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/cbfonts-fd\lgrcmr.
fd
File: lgrcmr.fd 2017/07/29 v1.2 Greek European Computer Regular
)
LaTeX Font Info:    ... okay on input line 27.

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/context/base/mkii\supp-p
df.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count277
\scratchdimen=\dimen174
\scratchbox=\box52
\nofMPsegments=\count278
\nofMParguments=\count279
\everyMPshowfont=\toks33
\MPscratchCnt=\count280
\MPscratchDim=\dimen175
\MPnumerator=\count281
\makeMPintoPDFobject=\count282
\everyMPtoPDFconversion=\toks34
)
(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/epstopdf-pkg\epsto
pdf-base.sty
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
85.

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/00miktex\epstopdf-
sys.cfg
File: epstopdf-sys.cfg 2021/03/18 v2.0 Configuration of epstopdf for MiKTeX
))
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
*geometry* verbose mode - [ preamble ] result:
* driver: pdftex
* paper: a4paper
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes: 
* h-part:(L,W,R)=(89.62709pt, 418.25368pt, 89.6271pt)
* v-part:(T,H,B)=(101.40665pt, 591.5302pt, 152.11pt)
* \paperwidth=597.50787pt
* \paperheight=845.04684pt
* \textwidth=418.25368pt
* \textheight=591.5302pt
* \oddsidemargin=17.3571pt
* \evensidemargin=17.3571pt
* \topmargin=-7.86334pt
* \headheight=12.0pt
* \headsep=25.0pt
* \topskip=12.0pt
* \footskip=30.0pt
* \marginparwidth=44.0pt
* \marginparsep=10.0pt
* \columnsep=10.0pt
* \skip\footins=10.8pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidefalse
* \@mparswitchfalse
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)

LaTeX Font Info:    Trying to load font information for U+msa on input line 30.

(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/amsfonts\umsa.fd
File: umsa.fd 2013/01/14 v3.01 AMS symbols A
)
LaTeX Font Info:    Trying to load font information for U+msb on input line 30.


(C:\Users\Lala\AppData\Local\Programs\MiKTeX 2.9\tex/latex/amsfonts\umsb.fd
File: umsb.fd 2013/01/14 v3.01 AMS symbols B
)
! Argument of \rmathbr@orig@goestoarg has an extra }.
<inserted text> 
                \par 
l.32 $\goestoarg{
                 a}{b}$ %<- does not work
? 
Runaway argument?
! Paragraph ended before \rmathbr@orig@goestoarg was complete.
<to be read again> 
                   \par 
l.32 $\goestoarg{
                 a}{b}$ %<- does not work
? 
! Missing $ inserted.
<inserted text> 
                $
l.32 $\goestoarg{
                 a}{b}$ %<- does not work
? 
! Missing } inserted.
<inserted text> 
                }
l.32 $\goestoarg{
                 a}{b}$ %<- does not work
? 
! Too many }'s.
<recently read> }
                 
l.32 $\goestoarg{
                 a}{b}$ %<- does not work
? 
! Missing $ inserted.
<inserted text> 
                $
l.34 
     
? 
[1

{C:/Users/Lala/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]
(Test12.aux) ) 
Here is how much of TeX's memory you used:
 7565 strings out of 479283
 112372 string characters out of 2852377
 434818 words of memory out of 3000000
 24941 multiletter control sequences out of 15000+600000
 408839 words of font info for 46 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 68i,16n,75p,1197b,108s stack positions out of 5000i,500n,10000p,200000b,80000s
{C:/Users/Lala/AppData/Local/Programs/MiKTeX 2.9/fonts/enc/dvip
s/cm-super/cm-super-t1.enc}<C:/Users/Lala/AppData/Local/Programs/MiKTeX 2.9/f
onts/type1/public/amsfonts/cm/cmmi12.pfb><C:/Users/Lala/AppData/Local/Program
s/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmmi8.pfb><C:/Users/Lala/AppData/
Local/Programs/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmsy10.pfb><C:/Users/R
asmus/AppData/Local/Programs/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmsy8.pf
b><C:/Users/Lala/AppData/Local/Programs/MiKTeX 2.9/fonts/type1/public/cm-supe
r/sfrm1200.pfb>
Output written on Test12.pdf (1 page, 36772 bytes).
PDF statistics:
 27 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)


I am running pdflatex 3.141592653-2.6-1.40.22 (MikTeX 21.3), and every package in my local distrubution was updated earlier today.

4
  • You can define \def\goestoarg#1#2{\xrightarrow{#1\to#2}\allowbreak}, you need not to use \SetBreakableRel.
    – wipet
    Apr 28 at 20:46
  • @wipet Unless I am missing something, that doesn't work: the symbol \goestoarg does not get repeated on the new line. The aim is to have the symbol where line break takes place to be duplicated. Apr 29 at 12:33
  • I cannot even get your MWE to build. There seems to be some weird conflict between mathtools and rmathbr. Apr 29 at 18:42
  • @WillieWong May I ask if you are using the most recent version of rmathbr (from Dec 2020)? I tried to hint at this necessity in the beginning of the question; but I could've perhaps been more explicit :). Apr 29 at 18:44
1

Only minimally tested, but this should work. There may be a reason why this is not suggested in the documentation, but I haven't been able to reason out when something like this should fail to work.

\documentclass[12pt]{article}
%\usepackage[utf8]{inputenc}
%\usepackage[english]{babel}
\usepackage{amsmath}
%\usepackage{amssymb}
%\usepackage{amsthm}
\usepackage{mathtools}
\usepackage[pdftex]{graphicx}
%\usepackage{titlesec}
\usepackage{rmathbr}
%\usepackage{parskip}
%\usepackage[a4paper]{geometry}

\newcommand{\goesto}{\xrightarrow{n\to\infty}} %works great
\SetBreakableRel{\goesto} %works great

\DeclareRobustCommand{\goestoarg}[2]{\brokenrel{\xrightarrow{#1\to#2}}}

\begin{document}


$e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e\goesto e$

$e\goestoarg{a}{b} e \goestoarg{a}{b} e \goestoarg{a}{b} e \goestoarg{a}{b} e \goestoarg{a}{b} e \goestoarg{a}{b} e \goestoarg{a}{b} e \goestoarg{a}{b} e \goestoarg{a}{b} e \goestoarg{a}{b} e \goestoarg{a}{b} e \goestoarg{a}{b} e \goestoarg{a}{b} e $ 
%$\Goestoarg{a}{b}$ %<- also does not work


\end{document}
6
  • Thank you for the answer (+1)! If I may ask, what are you using for compilation? Overleaf / local distribution? I currently get errors when trying to build your solution (! incomplete \ifx; all text was ignored after line 46 with the most recent packages/distribution (as quoted in the bottom of OP). Apr 29 at 19:17
  • 1. Thank you, now your "main" solution (with two variable arguments) works nicely on initial testing. 2. I haven't gotten your "alternative" syntax (with one variable argument) to work. When you say "skip most of the code I included", which parts did you have in mind one should keep? (Of course, in addition to the three lines where one-variable \goestoarg is defined.) I double checked that I was using \goestoarg{a \to b} syntax here but simply says ! undefined control sequence \goestoarg. Any ideas? Apr 29 at 19:39
  • Hang on... something is not right. Let me try to fix it first. Apr 29 at 19:56
  • 1
    @LinearChristmas I took a few more minutes to trace through the code in the package... I think the above should work. All the various wrapper code that was included seems to be for some other purpose. Apr 29 at 20:05
  • Thank you for doing this. Based on two initial tests, this works great, and has the benefit of looking simple syntactically! I will probably accept your answer in (at most) 24–48 h, maybe sooner, depending on some other tests. Until then, thank you again! Apr 29 at 20:26

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.