2

Feeding

\documentclass{article}
\pagestyle{empty} 
\usepackage{mathtools}
\begin{document}
\[
  \begin{multlined}[c]
    \text{Line}\ 1\\
      \begin{aligned}[c]
        &\text{Line}\ 2.1\\
        \lor\ &\text{Line}\ 2.2\\
        \lor\ &\text{Line}\ 2.3
      \end{aligned}\text{stuff to the right}
  \end{multlined}
\]
\end{document}

to pdflatex yields

simple output

As you see, there is some white space just before “stuff to the right”.

You might think this is not that bad, but here it gets worse:

\documentclass{article}
\pagestyle{empty} 
\usepackage{mathtools}
\begin{document}
\[
  \begin{multlined}[c]
    \text{Line}\ 1\\
    \land \begin{aligned}[c]
      \left(
      \begin{aligned}[c]
        &\text{Line}\ 2.1\\
        \lor\ &\text{Line}\ 2.2\\
        \lor\ &\text{Line}\ 2.3
      \end{aligned}
    \right)
    \end{aligned}
  \end{multlined}
\]
\end{document}

produces

output

As you see, there is superfluous white space to the left of the right closing paren. If we have longer formulas and more environment nesting, the white space grows. Where does this space come from? How to get rid of it without putting in hardcoded negative distances, such as \mskip-5mu? Btw., \mleft(…\mright) instead of \left(…\right) result in the same problem.

2 Answers2

2

I suppose, that desired result of your MWE is:

enter image description here

For it I use pmatrix instead of aligned:

\documentclass{article}
\pagestyle{empty}
\usepackage{mathtools}
\begin{document}
\[\setlength\arraycolsep{2pt}
  \begin{multlined}
    \text{Line}\ 1\\
    \land \begin{pmatrix}
                &\text{Line } 2.1\\
        \lor    &\text{Line } 2.2\\
        \lor    &\text{Line } 2.3
      \end{pmatrix}
  \end{multlined}
\]
\end{document}

or with use of array:

\documentclass{article}
\pagestyle{empty}
\usepackage{mathtools}

\begin{document} [\setlength\arraycolsep{3pt} \begin{multlined} \text{Line}\ 1\ \land \left(\begin{array}{rl} &\text{Line } 2.1\ \lor &\text{Line } 2.2\ \lor &\text{Line } 2.3\ \end{array}\right) \end{multlined} ] \end{document}

enter image description here

Zarko
  • 296,517
  • In fact, not quite: then we have too much space after \lor. Thanks in any case for the answer! –  Oct 11 '22 at 12:39
  • @AlbertNash, well if you like to have even smaller distances in matrix, see edited answer. Added is also new example with array – Zarko Oct 11 '22 at 12:48
  • Thx! Probably we might wish to have a more compact array specification instead of {rl}, such as {@{}r{\>}l@{}} or similar. –  Oct 12 '22 at 19:15
  • @AlbertNash, sorry, I don't understand, what you like to tel me in your last comment and what you after with your question. I show you two ways, how to reduce space in matrix. If you now for third, better way, write own answer. However, in the second example you can set \setlength\arraycolsep{0pt} ... – Zarko Oct 12 '22 at 19:27
  • All is fine, no worries, thx! I simply referred to {rl} in your array example. –  Oct 12 '22 at 19:59
  • @AlbertNash, I don't vory, but I'm curious: does my suggestions solve your problem? – Zarko Oct 12 '22 at 20:10
  • 1
    @AlbertNash, you are right. Thank you for editing answer – Zarko Oct 14 '22 at 17:20
  • Thx! Two other issues are: (1) In the innermost environment, instead of displaystyle in the original post, we get textstyle. (2) The line distance is not increased by \jot inside pmatrix or array. For (2), we can say \\[\jot], but I don't know how to get (1) without inserting \displaystyle into every cell. –  Oct 14 '22 at 17:23
  • @AlbertNash, for (1): are you sure? It is the same as in your code. The array is in displaystyle, – Zarko Oct 14 '22 at 18:52
  • When I put \mathchoice{display}{text}{script}{scriptscript} into pmatrix or array (I tested a few cells), I get "text"… So yes, I'm sure. –  Oct 14 '22 at 18:55
  • @AlbertNash, if you have new problem, please ask new question. My answer solve what you exposed in your question as a problem. – Zarko Oct 14 '22 at 18:59
  • I am still missing an answer to "Where does this space come from?". Your answer does not only get rid of the space, it also changes some other formatting parameters. So, purely technically, your post doesn't answer the question in the original post fully or properly. Still, it might be helpful (to someone else, just not to me). Thank you anyway for your efforts! I upvoted. –  Oct 14 '22 at 19:05
  • @AlbertNash, If you not satisfied with my answer, you can freely remove your upvote. Of course, I expect than you will not use my suggested workarounds. As I see, about this problem you ask new question ... you may be more lucky with responses on it. – Zarko Oct 14 '22 at 19:15
  • No, you invested effort, and it's serious, so, here at TeX.SE, we honour this and upvote this. As for what we (I or anyone else) use or don't use, we (I or anyone else) may tell you; however, don't expect anything. Your answer is in the public domain. Legally, it's no longer fully yours. –  Oct 14 '22 at 19:18
0

I dunno where the space comes from. Here's how to get rid of it while maintaining the line distance and displaystyle.

\documentclass{article}
\pagestyle{empty} 
\usepackage{mathtools}
\begin{document}
\[
  \begin{multlined}[c]
    \text{Line}\ 1\\
      \begin{alignedat}[c]{1}
        &\text{Line}\ 2.1\\
        \lor\ &\text{Line}\ 2.2\\
        \lor\ &\text{Line}\ 2.3
      \end{alignedat}\text{stuff to the right}
  \end{multlined}
\]
\end{document}

yields

output

  • Sorry, you should say in question that you not like to have parenthesis, If you remove them from my suggestion you will get (almost) the same result. Sorry, but now your question and expectation is unclear and also you not explain, how you solve your problem. – Zarko Oct 14 '22 at 19:22
  • No. What seems almost the same to you makes a difference to others. –  Oct 14 '22 at 19:29