4

I don't understand why the [t] parameter of the array environment does not do anything. I want the top of the brace to be aligned with the top of my item label but it does not work.

\documentclass{article}

\begin{document}    
\begin{itemize}
    \item $\hspace*{-1pt}\left\{\begin{array}[t]{@{}c@{}}
        ughjgh\\
        sdsfsfsf\\
        zfzfzfzfz
    \end{array}\right\}$
\end{itemize}
\end{document}
7
  • You simply don't have enough text on your page to see its effect wrt floating environments.
    – MS-SPO
    Commented May 23 at 17:25
  • [t] puts the baseline of the first line of the array (in your case the only line) on the current baseline. Commented May 23 at 17:35
  • 1
    note if you have more than one row in the array \left\{\begin{array}[t] rarely does what you want. see the delarray package. Commented May 23 at 17:38
  • @David Yes, I only put a few characters for the MWE but of course I have a much larger array. I tried to load delarray too. Commented May 23 at 17:59
  • 1
    delarray does exactly that Commented May 23 at 20:40

4 Answers 4

3

Using adjustbox package to align vertically the content. With the option valign=t ensures that the content is aligned with the top of the box. Here you not must use \hspace*{-1pt} and array.

\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{adjustbox}

\begin{document}

\begin{itemize}
    \item \adjustbox{valign=t}{$\begin{Bmatrix}
        a^2 + b^2 = c^2 \\
        \int_a^b f(x) dx \\
        e^{i\pi} + 1 = 0
    \end{Bmatrix}$}
\end{itemize}

\end{document}

enter image description here

5
  • In my complex arrow only this worked. Commented May 24 at 7:56
  • 1
    @VincentKrebs Why?
    – Sebastiano
    Commented May 24 at 9:43
  • 1
    Both begin and end are under the scope of the same Boolean condition. I dont know if it plays a role, but using \begin{adjustbox}{valign=t} works like a charm. Commented May 24 at 14:06
  • 1
    @VincentKrebs I am happy to have had luck :-)
    – Sebastiano
    Commented May 24 at 14:59
  • 1
    I just think adjustbox is an amazing package... Commented May 24 at 16:05
5

With {BNiceArray} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}    
\begin{itemize}
\item \hspace*{-1pt}
$\begin{BNiceArray}[t]{c}
    ughjgh\\
    sdsfsfsf\\
    zfzfzfzfz
\end{BNiceArray}$
\end{itemize}
\end{document}

Output of the above code

3

No extra packages:

\documentclass{article}

\begin{document}    
\begin{itemize}
    \item \raisebox{\dimexpr \ht\strutbox-\height}{$\hspace*{-1pt}\left\{\begin{array}{@{}c@{}}
        ughjgh\\
        sdsfsfsf\\
        zfzfzfzfz
    \end{array}\right\}$}
\end{itemize}
\end{document}
2

With delarray.


\documentclass{article}

\usepackage{delarray}

\begin{document}    
\begin{itemize}
    \item \hspace*{-1pt}\begin{array}[t]\{{@{}c@{}}\}
        ughjgh\\
        ssfsfs\\
        fssffsf
    \end{array}
\end{itemize}
\end{document}

You must log in to answer this question.

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