2

How do I get rid of the indentation of the second line? I would like the two lines to be aligned to each other. I had thought that both having maximum width, the first being left-aligned, the second right-aligned, that they are mutually aligned, but that's not the case:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation*}%
\begin{multlined}%
\framebox[\linewidth]{LONG}\\%
\framebox[\linewidth]{LONG}%
\end{multlined}%
\end{equation*}
\end{document}

Edit: Yes, I need multlined.

3
  • Thanks. In my actual use case, I need the first line flush left and the second flush right. However, I noticed that the second line exeeds the right page border, despite being short enough to fit into the line. I concluded that there must be some indentation going on, which one can confirm looking at other examples. So in the end, I just want to make sure the second line stays within page limits, and the above example should work fine demonstrating the problem and proving solutions.
    – bers
    Feb 4, 2015 at 0:24
  • fbox with what inside? Sorry, I do not see how this relates to my question. framebox is just a placeholder, you could also use LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG. You still see the second line indented.
    – bers
    Feb 4, 2015 at 0:33
  • I bet there is another way to solve this (by removing indentation) than breaking something which would fit without indentation...
    – bers
    Feb 4, 2015 at 0:44

2 Answers 2

4

Set \multlinegap to 0pt (but, quite frankly, I don't understand why do you want to do this instead of using some other environment (align, gather)):

\documentclass{article}
\usepackage{mathtools}

\setlength\multlinegap{0pt}

\begin{document}
\begin{equation*}%
\begin{multlined}%
\framebox[\dimexpr\linewidth-2\fboxsep\relax]{LONG} \\
\framebox[\dimexpr\linewidth-2\fboxsep\relax]{LONG}
\end{multlined}%
\end{equation*}
\end{document}

enter image description here

1
  • Thanks, that's what I have been looking for! Of course, I do have a more relevant use case for my problem than the MWE that I posted (necessarily involving multlined), but I could reduce it to this simple case which (I agree) one would have been able to solve differently.
    – bers
    Feb 4, 2015 at 14:28
-1

If you want them to be aligned to each other use aligned or gathered rather than multlined. Or, may be, only align* or gather* rather than equation* with an inner environment.

3
  • You are right. But when my question title explicitly includes in multlined, you may guess that I am serious about this requirement, even if my MWE may offer alternative solutions.
    – bers
    Feb 4, 2015 at 14:30
  • I know, I reread the question, I just think still the answer might be this one.
    – Manuel
    Feb 4, 2015 at 14:46
  • No, because I don't want things to be aligned to each other. I want the first line flush left, the second flush right. This is what I was trying to achieve. Now when you apply that scheme to two full-width boxes (just to test!), they should come out aligned to each other as a side product. However, they didn't. So I was obviously not getting it right. Again: my use case does not involve two full-width boxes, so your answer it not helpful, sorry.
    – bers
    Feb 4, 2015 at 14:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .