Line breaking in math mode

Under default settings a line can be broken in math mode after binary operator with \binoppenalty or after relation with \relpenalty. I'd like to preserve this behavior but alter the result so the operator or relation is repeated on the next line as should be in Czech typography. Just putting \discretionary{\subseteq}{\subseteq}{\subseteq} instead of \subseteq raises an error.

• Are tex.stackexchange.com/q/61074 and tex.stackexchange.com/q/140951 what you want? – LaRiFaRi Jul 3 '14 at 10:25
• Is there an actual Czech typography rule for that or a convention among books? I'm really suspicious about that. – percusse Jul 3 '14 at 10:26
• @egreg In Czech the word „modro-zelený“, literally “blue-green” in English, means “having some parts which are blue and some parts which are green” whereas „modrozelený“ means “teal”. I think similar semantic difference is also in German. I agree that it is just detail and many speakers even don't think about it but there may be semantic difference. Of course there wouldn't be problem if hyphen wasn't used for two different purposes. Nevertheless even if I decide not to allow breaking at the hyphen, I have to tell TeX somehow and it seems that TeX is not flexible in specifying these rules. – user87690 Jul 3 '14 at 13:30
• @user87690 It seems that you understand Czech. You can see "TeXbook naruby" (http:/petr.olsak.net/tbn.html), page 160, where is the instruction how to do this automatically by setting math-active characters. – wipet Oct 6 '14 at 15:03
• @user87690 About repeated hyphen char: There are 5 different solutions of this problem mentioned in "TeXbook naruby" on pages 216--219. – wipet Oct 6 '14 at 16:06

\documentclass{article}
\setlength\textwidth{4cm}

%\newcommand\dup[1]{\;{#1}\discretionary{}{\hbox{$#1$}}{}\;}

\relpenalty=10000
\newcommand\dup[1]{#1\discretionary{}{\hbox{$#1$}}{}}% improved version from wipet

\begin{document}

\noindent X\dotfill X

$A \dup\subset A \dup\subset A \dup\subset A \dup\subset A \dup\subset A \dup\subset A \dup\subset A \dup\subset A \dup\subset A$
\end{document}

• The definition \def\dup#1{#1\discretionary{}{\hbox{$#1$}}{}} is sufficient. The spacing around math-rel is inserted after other material (i.e. after \discretionary), so space after relation is properly inserted in broken line too. – wipet Oct 6 '14 at 14:58
• @wipet but then I think it needs \relpenalty=10000 to stop it breaking before the discretionary, will add. – David Carlisle Oct 6 '14 at 15:41
• Yes, \relpenalty=10000. The same I mentioned in my Czech book. – wipet Oct 6 '14 at 16:03