1

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}
    \pagestyle{headings}
    \linespread{1}
    \hypersetup{colorlinks=true,linkcolor=black,pdfnewwindow=true,urlcolor=blue}
    \begin{document}

    \section{Nadpis}\label{sec:nadpisa}
    Text pod nadpisem.
    \subsection{Podnadpis}\label{sec:podnadpisa}
    Text pod podnadpisem.
    \subsubsection{Podpodnadpis}\label{sec:podpodnadpisa}
    Text pod podpodnadpisem.

    \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: TeXnic Center getting stuck without pdf output. After excluding breqn package the error disappear.

After excluding \usepackage[IL2]{fontenc} it freezes three lines before: TeXnic Center getting stuck #2

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

7
  • 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, 2014 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]). May 23, 2014 at 16:09
  • The reason is in my czech diacritics ... after deleting (inputenc, babel, fontenc) it's working fine, just diacritics marks are missing May 23, 2014 at 16:15
  • @questioner01 Without an example of a document that freezes, we can give very little help.
    – egreg
    May 23, 2014 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? May 23, 2014 at 16:40

1 Answer 1

1

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}
\pagestyle{headings}
\linespread{1}
\hypersetup{colorlinks=true,linkcolor=black,pdfnewwindow=true,urlcolor=blue}
\begin{document}

\section{Nadpis}\label{sec:nadpisa}
Text pod nadpisem.
\subsection{Podnadpis}\label{sec:podnadpisa}
Text pod podnadpisem.
\subsubsection{Podpodnadpis}\label{sec:podpodnadpisa}
Text pod podpodnadpisem.

\begin{equation}
\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}
\end{equation}

\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} 

enter image description here

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

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.