3

So, I've been searching around and I came across a few examples that will allow you to valign two cells in a certain way, but I'm trying to align three, so that the first it at the top, the middle is in the middle, and the third is at the bottom. Here is what I've been messing with, but I'm obviously not understanding something important. Any help would be greatly appreciated.

\documentclass{book}
\usepackage{lipsum}
\begin{document}
  \begin{tabular}{cp{2.8in}c}
    \multicolumn{1}{b{0.2in}}{\Huge{``}}    &
    \multicolumn{1}{m{2.8in}}{\lipsum[1]} &
    \Huge{"}   \\
  \end{tabular}
\end{document}

3 Answers 3

3

That's not easily possible. But there's a way around it: Insert the quotes at the start and end manually, with some overlap into the adjacent columns.

enter image description here

\documentclass{article}

\usepackage{lipsum}

\begin{document}

\begin{tabular}{ c p{2.8in} c}
  \hphantom{\Huge ``} & % Just for appropriate horizontal space
  \raisebox{-.5\normalbaselineskip}[0pt][0pt]{\makebox[0pt][r]{\Huge ``\hspace{2\tabcolsep}}}%
  \lipsum*[1]%
  \hfill\raisebox{-\normalbaselineskip}[0pt][0pt]{\makebox[0pt][l]{\hspace{2\tabcolsep}\Huge ''}} &
  \hphantom{\Huge ''}% Just for appropriate horizontal space
\end{tabular}

\end{document}

You don't need a tabular structure for this, since the placement of the quotes rely on the content, so could also be set in a \parbox, say.

2
  • This works great, but I don't understand why, lol. what is actually doing the work here? Jun 9 at 18:29
  • @JasonMurray: Fundamentally I print the left quotes in a zero-width box that is right-aligned and the right quotes in a zero-width box that is left-aligned. The zero widths allows the center column to have the text still conform to the width requirement for wrapping/hyphenation. However, the zero-width boxes may cause issues if you have document elements to the left/right of the table, hence the use of an \hphantom on either side to take up the correct space of quotes. Some vertical adjustment is done using \raisebox so the \Huge quotes look better/more aligned to the \normalsize font.
    – Werner
    Jun 10 at 2:31
3

With {NiceTabular} of nicematrix.

\documentclass{book}
\usepackage{nicematrix}
\usepackage{lipsum}

\begin{document}

\begin{NiceTabular}{cp{2.8in}c}
  \Block[T]{}{\Huge ``}    &
  \multicolumn{1}{m{2.8in}}{\lipsum[1]} &
  \Block[B]{}{\raisebox{-\normalbaselineskip}[0pt][0pt]{\Huge "}}  
\end{NiceTabular}

\end{document}

Output of the above code

2
  • so, its giving me the following error "Package nicematrix Error: The key 'T' is unknown for the command \Block." Looking at the documentation for nicematrix, and I have no idea what its on about, because it definitely IS what the documentation says. Jun 9 at 16:41
  • You have probably not the latest version of nicematrix. You should try to update thoroughly your TeX installation. Jun 9 at 18:53
2

tblr environment from tabularray package has a feature-rich more-intuitive key=value(s) interface.

Example:

tblr

MWE

\documentclass{book}
\usepackage{lipsum}
\usepackage{xcolor}

\usepackage{tabularray}
\begin{document}
  \begin{tblr}{
%  vlines,hlines,
  colspec={Q[h,r]X[j,m,3.5in,bg={blue!5}]Q[f,l]},
  column{1}={fg={red},rightsep={0pt}},
  column{3}={fg={red},leftsep={0pt}},
    }
    {\Huge{``}}  &
    \lipsum[1]  &
    \Huge{"}    \\
  \end{tblr}
\end{document}

Note - slight edit

\Huge is a switch and does not take parameters.

It can be set in the column spec.

  \begin{tblr}{
%  vlines,hlines,
  colspec={Q[h,r]X[j,3.5in,bg={blue!5}]Q[f,l]},
  column{1}={font={\Huge},fg={red},rightsep={0pt}},
  column{3}={font={\Huge},fg={red},leftsep={0pt}},
    }
    ``  &
    \lipsum[1]  &
    "    \\
  \end{tblr}
1
  • Thank you! the \huge thing was me not copy and pasting what i had in the actual document, but retyping it. I had {\Huge ``}, lol. Thank you! Jun 9 at 13:06

You must log in to answer this question.

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