Russian (Czech, Polish, etc.) tradition of equations breaking [duplicate]

This question already has an answer here:

According to the Russian (Czech, Polish, etc.) typesetting tradition, we have the following rules of equation breaking:

If an equation cannot be fit into one line, a typesetter should put part of the equation to the next line. First of all, breaking is allowed on binary relation symbols (=, <, etc.) and signs +, -. In the second place, breaks are allowed on multiplication signs (not on divisions!).

The symbol where the break was done should be repeated in the beginning of the next line. The "x" sign should be used in case of break in multiplication.

The question is how to achieve this behaviour.

As one can see, it's not an issue for displayed equations since breaking is always done manually. Interesting part are embedded equations which LaTeX can break without repeating the sign of operation.

Possible yet conservative solution is to turn off equation breaking inside paragraph at all. Unfortunately this could cause too large spaces between words.

marked as duplicate by egreg, Guido, Werner, cmhughes, diabonasOct 27 '13 at 22:23

• This is a tradition I would break. – egreg Oct 27 '13 at 17:20
• @egreg Haha :) Seriously, the tradition makes sense since sign repetition facilitates reading – Yury Bayda Oct 27 '13 at 17:49
• To the contrary, I believe it hinders reading. – egreg Oct 27 '13 at 18:59
• For me this is mainly interesting in the case of a minus sign, because --1=+1. Other symbols do not cause ambiguity when repeated. – marczellm Oct 27 '13 at 22:22

I found the russmath package (not on CTAN) perfectly solves the problem. It defines a universal way to declare correctly breakable binary operations and relations through \bbin{<expr>} and \brel{<expr>} commands correspondingly.

It employs the following code

\global\relpenalty=10000
\global\binoppenalty=10000

\makeatletter
\def\m@th{\mathsurround=0pt}
\def\@thick{\hbox{\m@th$\mskip\thickmuskip$}}
\def\@med{\hbox{\m@th$\mskip\medmuskip$}}

\def\brel#1{\discretionary{\@thick\hbox{\m@th$#1$}}{}{} #1}
\def\bbin#1{\discretionary{\@med\hbox{\m@th$#1$}}{}{} #1}
\makeatother

Here are some examples from the package documentation (in Russian): These are also Polish rules. In the multiline displayed equation it is simple: one writes down needed symbols. Interesting part is a non-displayed case. The set o macros by Jacek Czekaj should be useful in this case:

http://www.gust.org.pl/bachotex/2010/program

(Jacek Czekaj, Uniwersytet Śląski, Instytut Matematyki, Katowice, Polska `Pots.tex' and other useful plain TeX packages

This article firstly describes the pots.tex package designed for plain TeX. This is a set of macros providing convenient methods for typesetting mathematical formulas with respect to old traditions and practice, with support for encoding Polish characters in UTF-8 standard. Subsequently, the article describes how to include graphics in extended TeX, and other useful packages designed for plain TeX, which are not well documented.)

• In a multiline case it also should be done automatically. – Yury Bayda Oct 27 '13 at 14:21
• @megabyde If you are willing to suffer, you can. – yo' Oct 27 '13 at 14:50
• In general we're quite against "link-only" answers, and this seems to be close to it (well, certainly, it is not self-contained). Do you think you could include a small example of how is that package used? Thanks! – yo' Oct 27 '13 at 14:51
• @tohecz Yes, but I must find the conference materials. – Przemysław Scherwentke Oct 27 '13 at 21:42