# MikTeX cannot compile when breqn package included

I'm seeking for automatic line breaking of math expressions (the example bellow), best recommended option seems breqn package. After MikTeX installed mh packages, MikTeX cannot build an output (I use TeXnic Center editor) (the text content is shortened):

\documentclass[a4paper,fleqn,leqno]{article}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage[IL2]{fontenc}
\usepackage{color}
\usepackage[top=1.5in, bottom=1.5in, left=1in, right=1in]{geometry}
\usepackage{hyperref}
\usepackage{tikz}
\usepackage{amsmath,breqn}
\usepackage[fontsize=12]{scrextend}
\DeclareMathSizes{12}{16}{16}{16}
\begin{document}

\begin{multline}
t_{2}x_{1}cos\alpha+t_{2}y_{1}sin\alpha+t_{2}z_{1}sin\gamma cos\alpha-t_{2}z_{1}sin\alpha sin\beta-t_{3}x_{1}cos\alpha-t_{3}y_{1}sin\alpha-t_{3}z_{1}sin\gamma cos\alpha+t_{3}z_{1}sin\alpha sin\beta-t_{1}x_{2}cos\alpha-t_{1}y_{2}sin\alpha-t_{1}z_{2}sin\gamma cos\alpha+t_{1}z_{2}sin\alpha sin\beta+ t_{1}x_{3}cos\alpha+t_{1}y_{3}sin\alpha+t_{1}z_{3}sin\gamma cos\alpha-t_{1}z_{3}sin\alpha sin\beta+ t_{3}x_{2}cos\alpha+t_{3}y_{2}sin\alpha+t_{3}z_{2}sin\gamma cos\alpha-t_{3}z_{2}sin\alpha sin\beta- t_{2}x_{3}cos\alpha-t_{2}y_{3}sin\alpha-t_{2}z_{3}sin\gamma cos\alpha+t_{2}z_{3}sin\alpha sin\beta
\end{multline}
\end{document}


It freezes displaying: without pdf output. After excluding breqn package the error disappear.

After excluding \usepackage[IL2]{fontenc} it freezes three lines before:

showing the same error. Is there any solution without rewriting the whole content?

• Welcome to TeX.SX! I get no freezing nor error. However, the dmath environment should be used, not multline. Also, hyperref should be loaded last. And the \DeclareMathSizes line doesn't make any sense. – egreg May 23 '14 at 16:07
• fwiw, it doesn't freeze for me, with any of latex, pdflatex, xelatex or lualatex (all tl'13 -- i don't have miktex [or even windows]). – wasteofspace May 23 '14 at 16:09
• The reason is in my czech diacritics ... after deleting (inputenc, babel, fontenc) it's working fine, just diacritics marks are missing – questioner01 May 23 '14 at 16:15
• @questioner01 Without an example of a document that freezes, we can give very little help. – egreg May 23 '14 at 16:26
• As I said, (inputenc, babel, fontenc) is behind it. It's kind of incompatible with breqn. May it be helpful if I place the rest of the document here? – questioner01 May 23 '14 at 16:40

I use MiKTeX and breqn does work with babel, buts doesn't cooperate with most math package. You have to use the right environment, which is dmath. However I think aligned, used with \MoveEqLeft on first line, gives a better result. I give an example of both.

You'll have less problems if you use XeLaTeX and polyglossia. No more loading inputenc nor fontenc. The syntax for loading polyglossia with the Czech language is commented in my preamble; if you want to test, all you have to do is uncommenting these two lines and commenting the babel loading line.

\documentclass[a4paper,fleqn,leqno]{article}
\usepackage[utf8]{inputenc}
%\usepackage{polyglossia}
%\setmainlanguage{czech}
\usepackage[czech]{babel}
\usepackage[IL2]{fontenc}

\usepackage{color}
\usepackage[top=1.5in, bottom=1.5in, left=1in, right=1in]{geometry}
\usepackage{hyperref}
\usepackage{tikz}
\usepackage{mathtools,breqn}
\usepackage[fontsize=12]{scrextend}
\DeclareMathSizes{12}{16}{16}{16}
\begin{document}

\begin{aligned} \MoveEqLeft[3] t_{2}x_{1}\cosα + t_{2}y_{1}\sinα + t_{2}z_{1}\sinγ \cosα \\ & - t_{2}z_{1}\sinα \sinβ - t_{3}x_{1}\cosα - t_{3}y_{1}\sinα \\ & - t_{3}z_{1}\sinγ \cosα + t_{3}z_{1}\sinα \sinβ - t_{1}x_{2}\cosα \\ & - t_{1}y_{2}\sinα - t_{1}z_{2}\sinγ \cosα + t_{1}z_{2}\sinα \sinβ \\ & + t_{1}x_{3}\cosα + t_{1}y_{3}\sinα + t_{1}z_{3}\sinγ \cosα \\ & - t_{1}z_{3}\sinα \sinβ + t_{3}x_{2}\cosα + t_{3}y_{2}\sinα \\ & + t_{3}z_{2}\sinγ \cosα - t_{3}z_{2}\sinα \sinβ - t_{2}x_{3}\cosα \\ & - t_{2}y_{3}\sinα - t_{2}z_{3}\sinγ \cosα + t_{2}z_{3}\sinα \sin\beta \end{aligned}

\begin{dmath}
t_{2}x_{1}\cos\alpha+t_{2}y_{1}\sin\alpha+t_{2}z_{1}\sinγ \cos\alpha-t_{2}z_{1}\sinα \sin\beta-t_{3}x_{1}\cos\alpha-t_{3}y_{1}\sin\alpha-t_{3}z_{1}\sinγ \cos\alpha+t_{3}z_{1}\sinα \sin\beta-t_{1}x_{2}\cos\alpha-t_{1}y_{2}\sin\alpha-t_{1}z_{2}\sinγ \cos\alpha+t_{1}z_{2}\sinα \sin\beta+ t_{1}x_{3}\cos\alpha+t_{1}y_{3}\sin\alpha+t_{1}z_{3}\sinγ \cos\alpha-t_{1}z_{3}\sinα \sin\beta+ t_{3}x_{2}\cos\alpha+t_{3}y_{2}\sin\alpha+t_{3}z_{2}\sinγ \cos\alpha-t_{3}z_{2}\sinα \sin\beta- t_{2}x_{3}\cos\alpha-t_{2}y_{3}\sin\alpha-t_{2}z_{3}\sinγ \cos\alpha+t_{2}z_{3}\sinα \sin\beta
\end{dmath}

\end{document}


• As far as I remember the indentation can be configured in breqn – daleif May 23 '14 at 17:34
• @daleif: I didn't find information about that in the doc. But I don't know well breqn – Bernard May 23 '14 at 18:23
• Har about the indentstep key? See section 10. Not sure if it works – daleif May 23 '14 at 19:01
• Thanks, indeed the simplest solution! Breqn works fine with polyglossia in xelatex. – questioner01 May 23 '14 at 19:48
• @daleif: I tested the indentstep key, which I didn't know of. Unfortunately it shifts the whole group. – Bernard May 23 '14 at 20:01