0
\documentclass[10pt]{book}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{pgf,pgfplots}
\usepackage[utf8]{inputenc}
\usepackage[romanian]{babel}
\usepackage[paperwidth=15.5cm, paperheight=23.5cm, margin=2cm]{geometry}
\usepackage{amsthm,amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{rmathbr}
\usepackage{float}
\usetikzlibrary{math,arrows,positioning,shapes,fit,calc}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usepackage{xcolor}
\usepackage{enumitem}
\binoppenalty=10000
\relpenalty=10000
\begin{document}

s\\
\textit{Demonstra\c tie.} Demonstr\u am doar prima egalitate, c\u aci a doua e analoag\u a. Cum $f:A\to B$ \c si $1_A:A\to A$ rezult\u a c\u a func\c tiile $f\circ 1_A$ \c si $f$ au acela\c si domeniu de defini\c tie $A$ \c si acela\c si codomeniu $B$. Pentru orice $x\in A$, $(f \circ 1_A)(x)=f(1_A(x))=f(x)$, deci func\c tiile $f \circ 1_A$ \c si $f$ au \c si aceea\c si lege de asociere. \^In concluzie, $f\circ 1_A=f$.
\end{document}

The code above generates a small paragraph included in a math LaTeX document I'm working on. The problem with it is that on the third line of the pdf generated, the math is broken into two different lines. As you can see, I included the \binoppenalty and \relpenalty and they don't work. Please help me stop these kinds of unecessary line breaking in inline math. Thanks in advance!

  • For me the term 'inline' is inevitably linked to a construct that is breakable, so that it doesn't corrupt the paragraph's typography. Of course you can break these rules if you want. For example you can put an inline equation in an unbreakable box like mbox. In your case i would think about setting the equation in an equation or similar environment – user1146332 Apr 10 '20 at 9:28
  • 2
    Don't use the this package \usepackage{rmathbr}. It explicitly reintroduce break points (that's why you get two \circ there). – Ulrike Fischer Apr 10 '20 at 9:33
0

Just include the math inside a {}. In your case replace $(f \circ 1_A)(x)=f(1_A(x))=f(x)$ with ${(f \circ 1_A)(x)=f(1_A(x))=f(x)}$.

\documentclass[10pt]{book}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{pgf,pgfplots}
\usepackage[utf8]{inputenc}
\usepackage[romanian]{babel}
\usepackage[paperwidth=15.5cm, paperheight=23.5cm, margin=2cm]{geometry}
\usepackage{amsthm,amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{rmathbr}
\usepackage{float}
\usetikzlibrary{math,arrows,positioning,shapes,fit,calc}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usepackage{xcolor}
\usepackage{enumitem}
\binoppenalty=10000
\relpenalty=10000
\begin{document}

s\\
\textit{Demonstra\c tie.} Demonstr\u am doar prima egalitate, c\u aci a doua e analoag\u a. Cum $f:A\to B$ \c si $1_A:A\to A$ rezult\u a c\u a func\c tiile $f\circ 1_A$ \c si $f$ au acela\c si domeniu de defini\c tie $A$ \c si acela\c si codomeniu $B$. Pentru orice $x\in A$, ${(f \circ 1_A)(x)=f(1_A(x))=f(x)}$, deci func\c tiile $f \circ 1_A$ \c si $f$ au \c si aceea\c si lege de asociere. \^In concluzie, $f\circ 1_A=f$.
\end{document}

Result:

enter image description here

  • This is very cool. But is it possible to make it work without the need to insert { } ? I already wrote almost 20 pages of math equations and it is a pretty hard task to insert brackets everywhere. Thank you! – furfur Apr 10 '20 at 9:23
  • note that using {} freezes all the white space which makes setting paragraphs with large inline math expression seven harder. It is generally preferable to set the penalties to 10000 and not do this. – David Carlisle Apr 10 '20 at 10:03
  • @furfur see Ulrike's comment under the question for a global solution that does not disturb white space in the way that this would do. – David Carlisle Apr 10 '20 at 10:04
1

You're using rmathbr, whose purpose is to enable “Russian style” math typography, where breaking after operation and relation symbols is possible, with the repetition of the symbol on the next line.

You can disable the feature for binary operation symbols, keeping it for relations, by redefining an internal macro of the package.

On the other hand, since you seem to prefer never having a break after operation or relation symbols, you can just get rid of rmathbr and set the high penalties.

\documentclass[10pt]{book}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{pgf,pgfplots}
\usepackage[utf8]{inputenc}
\usepackage[romanian]{babel}
\usepackage[paperwidth=15.5cm, paperheight=23.5cm, margin=2cm]{geometry}
\usepackage{amsthm,amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{rmathbr}
\usepackage{float}
\usetikzlibrary{math,arrows,positioning,shapes,fit,calc}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usepackage{xcolor}
\usepackage{enumitem}
\binoppenalty=10000
%\relpenalty=10000 <--- does nothing with rmathbr

\makeatletter
\renewcommand\rmathbr@brokenbin[1]{#1}
\makeatother

\begin{document}

\noindent
\textit{Demonstrație.} Demonstrăm doar prima egalitate, căci a doua e analoagă. 
Cum $f:A\to B$ și $1_A:A\to A$ rezultă că funcțiile $f\circ 1_A$ și $f$ au 
același domeniu de defini\c tie $A$ și același codomeniu $B$. Pentru orice 
$x\in A$, $(f \circ 1_A)(x)=f(1_A(x))=f(x)$, deci funcțiile $f \circ 1_A$ și $f$ 
au și aceeași lege de asociere. În concluzie, $f\circ 1_A=f$.

\end{document}

I also showed that you can input Romanian characters as themselves (the output will have commas below the letters s and t).

enter image description here

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.