Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a looooooooong displaymath that I'm using breqn to break into smaller chunks. As there are no actual relation symbols, I've manually added \allowbreak everywhere I'd be happy for one to occur (if I get this to look right, I'll trim the code a bit). But the resulting display is not quite how I would like it, and I can't see in the documentation how one can tell the dmath environment about how it should look. Specifically, the lines seem to be left-justified except the first which has an overhand. I think it would look best if this overhand were eliminated and the whole lot were left-justified. Centring would be an acceptable alternative.

Of course, I could do the whole thing manually - now that I know where breqn would put the breaks, I can put them in by hand. But that just feels wrong!

Here's the code:

\documentclass{standalone}
\usepackage{breqn}

\begin{document}

\begin{dmath*}
d_1 c_4 d_1^{-1} c_1^{-1},\;\allowbreak
d_1 c_3^{-1} d_2^{-1} c_3,\;\allowbreak
d_2 a_2 d_2^{-1} a_3^{-1},\;\allowbreak
d_2 a_3^{-1} d_3^{-1} a_3,\;\allowbreak
d_3 c_2 d_3^{-1} c_3^{-1},\;\allowbreak
d_3 c_1^{-1} d_4^{-1} c_1,\;\allowbreak
d_4 b_3 d_4^{-1} b_4^{-1},\;\allowbreak
d_4 b_3^{-1} d_5^{-1} b_3,\;\allowbreak
d_5 c_1 d_6^{-1} c_1^{-1},\;\allowbreak
d_6 c_2^{-1} d_6^{-1} c_1,\;\allowbreak
d_6 a_3 d_7^{-1} a_3^{-1},\;\allowbreak
d_7 a_2^{-1} d_7^{-1} a_1,\;\allowbreak
d_7 c_3 d_8^{-1} c_3^{-1},\;\allowbreak
d_8 c_4^{-1} d_8^{-1} c_3,\;\allowbreak
d_8 b_1 d_8^{-1} b_2^{-1},\;\allowbreak
d_8 b_1^{-1} d_1^{-1} b_1,\;\allowbreak
b_2 a_4 b_2^{-1} a_1^{-1},\;\allowbreak
b_2 a_3^{-1} b_3^{-1} a_3,\;\allowbreak
b_4 a_3 b_1^{-1} a_3^{-1},\;\allowbreak
b_1 a_4^{-1} b_1^{-1} a_3
\end{dmath*}
\end{document}

And here's the result:

misaligned mathematics

share|improve this question
add comment

2 Answers

Can't you use it this way?

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\raggedright
$d_1 c_4 d_1^{-1} c_1^{-1},$
$d_1 c_3^{-1} d_2^{-1} c_3,$
$d_2 a_2 d_2^{-1} a_3^{-1},$
$d_2 a_3^{-1} d_3^{-1} a_3,$
$d_3 c_2 d_3^{-1} c_3^{-1},$
$d_3 c_1^{-1} d_4^{-1} c_1,$
$d_4 b_3 d_4^{-1} b_4^{-1},$
$d_4 b_3^{-1} d_5^{-1} b_3,$
$d_5 c_1 d_6^{-1} c_1^{-1},$
$d_6 c_2^{-1} d_6^{-1} c_1,$
$d_6 a_3 d_7^{-1} a_3^{-1},$
$d_7 a_2^{-1} d_7^{-1} a_1,$
$d_7 c_3 d_8^{-1} c_3^{-1},$
$d_8 c_4^{-1} d_8^{-1} c_3,$
$d_8 b_1 d_8^{-1} b_2^{-1},$
$d_8 b_1^{-1} d_1^{-1} b_1,$
$b_2 a_4 b_2^{-1} a_1^{-1},$
$b_2 a_3^{-1} b_3^{-1} a_3,$
$b_4 a_3 b_1^{-1} a_3^{-1},$
$b_1 a_4^{-1} b_1^{-1} a_3$

\end{document}

enter image description here

share|improve this answer
    
Do you know, that never occurred to me! I guess I need to stick it in a parbox to centre it as a whole on the page, but that's easy enough. Still, I'm curious as to why breqn behaves as it does. Thanks! –  Loop Space Apr 12 '11 at 20:39
    
If there had been an equal sign later, then the indent would save readability, making clear where the left-hand side started. (just my impression) –  Bruno Le Floch Apr 13 '11 at 0:16
add comment
up vote 2 down vote accepted

I found the answer to the actual question by digging in the breqn.sty file. Whilst Herbert's answer may be simpler and probably should be used if at all possible, just in case someone else really wants to do exactly what I described, here's how to do it. The reverse-indentation is controlled by a length called \eqmargin and setting that to 0pt removes it. To make this setting local to a given environment, it can be passed in using the style key in an optional argument.

Here's the three versions: the original, Herbert's suggestion, and then this version, with a double dose of lipsum fore and aft to show how the line width works.

\documentclass{standalone}
\usepackage{amsmath}
\usepackage{breqn}
\usepackage{lipsum}

\let\semicolon=\;
\renewcommand{\;}{\semicolon\allowbreak}

\begin{document}

\lipsum[1]

\begin{dmath*}
d_1 c_4 d_1^{-1} c_1^{-1},\;
d_1 c_3^{-1} d_2^{-1} c_3,\;
d_2 a_2 d_2^{-1} a_3^{-1},\;
d_2 a_3^{-1} d_3^{-1} a_3,\;
d_3 c_2 d_3^{-1} c_3^{-1},\;
d_3 c_1^{-1} d_4^{-1} c_1,\;
d_4 b_3 d_4^{-1} b_4^{-1},\;
d_4 b_3^{-1} d_5^{-1} b_3,\;
d_5 c_1 d_6^{-1} c_1^{-1},\;
d_6 c_2^{-1} d_6^{-1} c_1,\;
d_6 a_3 d_7^{-1} a_3^{-1},\;
d_7 a_2^{-1} d_7^{-1} a_1,\;
d_7 c_3 d_8^{-1} c_3^{-1},\;
d_8 c_4^{-1} d_8^{-1} c_3,\;
d_8 b_1 d_8^{-1} b_2^{-1},\;
d_8 b_1^{-1} d_1^{-1} b_1,\;
b_2 a_4 b_2^{-1} a_1^{-1},\;
b_2 a_3^{-1} b_3^{-1} a_3,\;
b_4 a_3 b_1^{-1} a_3^{-1},\;
b_1 a_4^{-1} b_1^{-1} a_3.
\end{dmath*}

\begingroup
\raggedright
\(d_1 c_4 d_1^{-1} c_1^{-1}\), 
\(d_1 c_3^{-1} d_2^{-1} c_3\), 
\(d_2 a_2 d_2^{-1} a_3^{-1}\), 
\(d_2 a_3^{-1} d_3^{-1} a_3\), 
\(d_3 c_2 d_3^{-1} c_3^{-1}\), 
\(d_3 c_1^{-1} d_4^{-1} c_1\), 
\(d_4 b_3 d_4^{-1} b_4^{-1}\), 
\(d_4 b_3^{-1} d_5^{-1} b_3\), 
\(d_5 c_1 d_6^{-1} c_1^{-1}\), 
\(d_6 c_2^{-1} d_6^{-1} c_1\), 
\(d_6 a_3 d_7^{-1} a_3^{-1}\), 
\(d_7 a_2^{-1} d_7^{-1} a_1\), 
\(d_7 c_3 d_8^{-1} c_3^{-1}\), 
\(d_8 c_4^{-1} d_8^{-1} c_3\), 
\(d_8 b_1 d_8^{-1} b_2^{-1}\), 
\(d_8 b_1^{-1} d_1^{-1} b_1\), 
\(b_2 a_4 b_2^{-1} a_1^{-1}\), 
\(b_2 a_3^{-1} b_3^{-1} a_3\), 
\(b_4 a_3 b_1^{-1} a_3^{-1}\), 
\(b_1 a_4^{-1} b_1^{-1} a_3\).
\endgroup

\begin{dmath*}[style={\eqmargin=0pt}]
d_1 c_4 d_1^{-1} c_1^{-1},\;
d_1 c_3^{-1} d_2^{-1} c_3,\;
d_2 a_2 d_2^{-1} a_3^{-1},\;
d_2 a_3^{-1} d_3^{-1} a_3,\;
d_3 c_2 d_3^{-1} c_3^{-1},\;
d_3 c_1^{-1} d_4^{-1} c_1,\;
d_4 b_3 d_4^{-1} b_4^{-1},\;
d_4 b_3^{-1} d_5^{-1} b_3,\;
d_5 c_1 d_6^{-1} c_1^{-1},\;
d_6 c_2^{-1} d_6^{-1} c_1,\;
d_6 a_3 d_7^{-1} a_3^{-1},\;
d_7 a_2^{-1} d_7^{-1} a_1,\;
d_7 c_3 d_8^{-1} c_3^{-1},\;
d_8 c_4^{-1} d_8^{-1} c_3,\;
d_8 b_1 d_8^{-1} b_2^{-1},\;
d_8 b_1^{-1} d_1^{-1} b_1,\;
b_2 a_4 b_2^{-1} a_1^{-1},\;
b_2 a_3^{-1} b_3^{-1} a_3,\;
b_4 a_3 b_1^{-1} a_3^{-1},\;
b_1 a_4^{-1} b_1^{-1} a_3.
\end{dmath*}

\lipsum[1]

\end{document}

breqn with no initial indent

share|improve this answer
    
Thanks! I had tried to follow what is going on in breqn.sty some time ago, but it is tough. Someone should compile a list of all the relevant lengths... –  Bruno Le Floch Apr 13 '11 at 14:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.