I use LaTeX to type my University Maths notes. In that, I often find myself faced with linebreaks in inline math expressions. In such a situation, I usually want to double the sign just before the break, putting one copy at line end and the other copy at the start of the following line. Unfortunately, TeX won't do that. Up till now, I had it do this manually (e.g. $d=$ $=\dim M$, $f:M\to$ $\to\mathbb{R}$ or even $x\mapsto$ \linebreak $\mapsto(x,f(x))$, because sometimes TeX breaks the line after the second copy). It is pretty boring to inspect the document for all such linebreaks, so I was wondering if there was a way of telling TeX to do this automatically. The ideal thing would be a macro \doubleatbreaks which, with the syntax \doubleatbreaks{<sign>} makes sure <sign> is doubled at linebreaks in inline math. E.g., \doubleatbreaks{=} would make =s double at breaks, \doubleatbreaks{\times} would make \times double at breaks, etc. Is there a way to do this?


As @egreg noted, rmathbr is the way. Just one thing: When I have a minus at a line break, I usually put a plus on the new line, because -+=- and --=+. rmathbr doubles the -. How can I get - (linebreak) + instead?

  • There's no need to repeat the symbol after a line break.
    – egreg
    Feb 27, 2016 at 11:35
  • 1
    You may want to look at the rmathbr package.
    – egreg
    Feb 27, 2016 at 11:47
  • @egreg Just downloaded it, but it has no .sty, only a .dtx, and TeX is just not loading it, it rightly complains there is no file rmathbr.sty. How do I solve this?
    – MickG
    Feb 27, 2016 at 12:18
  • OK I just needed to typeset the .ins.
    – MickG
    Feb 27, 2016 at 12:20
  • The package is in TeX Live and, I believe, in MiKTeX
    – egreg
    Feb 28, 2016 at 9:11

1 Answer 1


A few steps to get this done:

  1. Go to CTAN;
  2. Find the package rmathbr;
  3. Download it;
  4. Locate the downloaded file;
  5. Open rmathbr.ins;
  6. Typeset it (i.e. compile it);
  7. This produces a .sty; locate it and place it in a directory TeX will find it in;
  8. Add \usepackage{rmathbr} to your document's preamble.

This makes a lot of symbols repeat. Opening the .sty now also opens the .pdf of the documentation. The package seems to have few known issues, and the documentation says it should be loaded after other packages.

If someone wants, like me, to break a minus with a plus (i.e. $a-$ $+b$ with a linebreak in between), because -+=- and --=+, I hacked into the code of the package and produced this:

  \penalty\binoppenalty %

I created a file handleminus.tex containing the above code and with that, I got the following very simple MWE:

\input handleminus.tex

Foobar Foobar Baz Baz Tom Dick Harry Tizio Caio Sempronio sorrata $d=\dim M$. wojgaoperjgojefgiwejafoiwjofipjaweoifjwaeoifjowipjfowiepjf pqppp $a\times b$ qoifjoqiwjfoiwqjfoiqwjfoiqwjfoiqwjfoiwqjfo qpogkpoqwkgpoqwkpowq pqi $a-b$

Compiling to:

enter image description here

Remember, of course, to \input after loading the package, or the code above will be overwritten by the package's code and you will be back with repeated minuses.

Thanks egreg for pointing that package out.

Working a bit it is certainly possible to make a version of \xbrokenbin that takes two arguments and creates a command that prints the first argument, breaks the line and then gives the second argument, i.e. one such that \xbrokenbin{-}{+} gives what the above code produces. However, I don't need such contortions, so I will not take the time to do that. Also, I would discourage such contortions: having a \subseteq repeat like a \cdot would be very odd.

  • I have some problems with iteractions of this package and some others. graphicsx, cancel, etc, but all problems were solved by putting '\usepackage{rmathbr}' to the end of preambula.And I have seen the code and now have no idea where it can interact with other packages. So, Can it affect another packages really?
    – user98432
    Apr 23, 2016 at 17:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .