4

I am new to writing in Latex and I'm struggling with what is probably a simple formatting issue.

In essence, what I would like is for the left square bracket to be in line with the comma after -a in the array - exactly as in the picture below.

enter image description here

My current code (without the alignment) has been included below.

\begin{align}
\left (\left. \frac{t^{2}}{5x} \right| \begin{array}{ll}    0   \\  - a,\lambda+K,\lambda -\frac{1}{18}K  \\\end{array} \right) 
\\ \notag \ \left[t>0, \quad 0<\lambda \right]  
\end{align}

This produces the following:

enter image description here

As you can see, the left square bracket is not aligned with the comma above.

Does anybody have any ideas on how to fix this? I suspect that this is a rather trivial problem, but I cannot seem to find anything online which will help.

  • Welcome to TeX.SE. I've edited your posting to remove the "Thanks Guys!" ending -- not because I don't care for politeness but because on this site, thank you's are best expressed by upvoting useful answers and accepting (by clicking on the check mark next to the answer) the "best" answer you may receive. – Mico Oct 11 '15 at 18:52
  • Thank you Mico. I am grateful for the responses I have received and will be choosing my favorite answer shortly. I have up-voted all three answers because each provide the desired solution to the problem. – Mr S 100 Oct 12 '15 at 7:42
3

Here's a solution that continues to use an align environment; it uses an \hphantom (a "horizontal phantom") at the beginning of the second row to achieve the required horizontal spacing offset.

In the first row, I would recommend making several adjustments to the code: (a) use \;\middle|\; to get a properly spaced vertical conditioning bar, (b) change the setup of the array environment to reflect the fact that it contains just one column, and (c) suppress the whitespace that's ordinarily inserted at the left- and right-hand edges of an array environment.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for "align*" environment

\begin{document}
\begin{align*}
&\left( \frac{t^{2}}{5x} \;\middle|\;
   \begin{array}{@{}l@{}} 0 \\ -a,\lambda+K,\lambda -\frac{1}{18}K \end{array} \right) \\ 
&\hphantom{\left( \frac{t^{2}}{5x} \;\middle|\; -a\right.}
[t>0, \quad 0<\lambda ]  
\end{align*}
\end{document}
  • Thanks for the Response. Whilst all responses answered the question, I found yours the easiest to understand (since I am familiar with the align environment). I also appreciate the advice on the adjustments to the first row; these have now been made. – Mr S 100 Oct 12 '15 at 9:31
  • @MrS100 - Many thanks for the compliment! – Mico Oct 12 '15 at 19:41
3

You can do that in a simple way with the blkarray package:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{blkarray, multirow}
\usepackage{mathtools}

\begin{document}

\[ \begin{blockarray}{cl@{}l}
  \begin{block}{(\BAmultirow{1em}|l@{}l)}%
    $ \dfrac{t^{2}}{5x} $ & 0 & \\
    & -a & ,\lambda+K,\lambda -\frac{1}{18}K\\
  \end{block}\noalign{\vskip 1.5ex}
  & &\left[t>0, \quad 0<\lambda \right]
  \end{blockarray} \]

\end{document}

enter image description here

2

I don't know, how important is vertical spacing, so I am leaving your original code and the vertical correction is only a suggestion.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
\left (\left. \frac{t^{2}}{5x} \right| \begin{array}{ll}    0   \\  - a,\lambda+K,\lambda -\frac{1}{18}K  \\\end{array} \right) 
\\ \notag \ \left[t>0, \quad 0<\lambda \right]  
\end{align}


\newlength{\arrcs}
\setlength{\arrcs}{2\arraycolsep}
\begin{align}
&\left (\left. \frac{t^{2}}{5x} \right| \begin{array}{ll}    0   \\  - a,\lambda+K,\lambda -\frac{1}{18}K  \\\end{array} \right) \\[-6pt]
%\\ \notag \ \left[t>0, \quad 0<\lambda \right]  
&\phantom{\Biggl(5x  -a,\hspace{\arrcs} }[t>0, \quad 0<\lambda]\notag
\end{align}

\end{document}

enter image description here

  • The spacing adjustment in the second set of equations doesn't seem to be quite what the OP specified: I believe the [ symbol in the final row is supposed to be immediately below the first , symbol in the preceding row. A separate matter: instead of inserting -6pt of additional vertical space and then using \phantom, you could use \hphantom instead of \phantom -- and drop the vertical spacing adjustment entirely. – Mico Oct 11 '15 at 19:08

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.