A few steps to get this done:
- Go to CTAN;
- Find the package
rmathbr
;
- Download it;
- Locate the downloaded file;
- Open
rmathbr.ins
;
- Typeset it (i.e. compile it);
- This produces a
.sty
; locate it and place it in a directory TeX will find it in;
- 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:
\makeatletter
\begingroup
\catcode`\-\active
\ifnum\mathcode`\-<32768
\xdef-{\noexpand\xbrokenbin{\mathchar\number\mathcode`\-}}
\else
\gdef-{\xbrokenbin{\mathchar8704}}
\fi
\endgroup
\DeclareRobustCommand{\xbrokenbin}[1]{\rmathbr@xbrokenbin{#1}}
\def\rmathbr@xbrokenbin#1%
{
\relax
\def\rmathbr@arg{#1}
\def\rmathbr@this{\rmathbr@xbrokenbin}
\def\rmathbr@output{\rmathbr@@xbrokenbin}
\futurelet\rmathbr@let@token\rmathbr@brokenop%
}
\def\rmathbr@@xbrokenbin#1%
{
\ifnum\lastpenalty=\relpenalty
\mathbin{#1}
\else
\mathbin{#1}
\ifx$\rmathbr@let@token
\else
\rmathbr@selector{+}
\fi
\fi
\rmathbr@setbrokens
\penalty\binoppenalty %
}
\def\rmathbr@selector#1%
{
\mathchoice
{\discretionary{}{\hbox{$\m@th\displaystyle#1$}}{}}
{\discretionary{}{\hbox{$\m@th\textstyle#1$}}{}}
{\discretionary{}{\hbox{$\m@th\scriptstyle#1$}}{}}
{\discretionary{}{\hbox{$\m@th\scriptscriptstyle#1$}}{}}%
}
\makeatother
I created a file handleminus.tex
containing the above code and with that, I got the following very simple MWE:
\documentclass[a4paper]{report}
\usepackage{amsmath,rmathbr}
\input handleminus.tex
\begin{document}
Foobar Foobar Baz Baz Tom Dick Harry Tizio Caio Sempronio sorrata $d=\dim M$. wojgaoperjgojefgiwejafoiwjofipjaweoifjwaeoifjowipjfowiepjf pqppp $a\times b$ qoifjoqiwjfoiwqjfoiqwjfoiqwjfoiqwjfoiwqjfo qpogkpoqwkgpoqwkpowq pqi $a-b$
\end{document}
Compiling to:
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.
rmathbr
package..sty
, only a.dtx
, and TeX is just not loading it, it rightly complains there is no filermathbr.sty
. How do I solve this?.ins
.