1

Below is a simplified example table I have:

Text

The code being:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{makecell}

\begin{document}

\begin{table}[h]
\begin{tabular}{|c|c|c|c|c|c|c|c|}
  \hline
  \textbf{CENTER THIS} & \textbf{\makecell[t]{Words \\ are here}} & \textbf{\makecell[t]{Blank \\ \#1}} & \textbf{\makecell[t]{Blank \\ \#2}} & \textbf{\makecell[t]{Blank \\ \#3}} & \textbf{\makecell[t]{Blank \\ \#4}} & \textbf{\makecell[t]{Blank \\ \#5}} & \textbf{\makecell[t]{Blank \\ \#6}} \\
  \hline
  Words & \makecell[t]{Words \\ are here} & {} & {} & {} & {} & {} & {} \\
  \hline
  Words & \makecell[t]{Words \\ are here} & {} & {} & {} & {} & {} & {} \\
  \hline
\end{tabular}
\end{table}

\end{document}

How do I vertically center the cell that says "CENTER THIS"?

1
  • 1
    I can’t test this at the moment, but I think you have to use \makecell[c] in the other cells. Jul 6 at 16:23

2 Answers 2

0

Tray \makecell[cc]{Words \\ are here} :

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{makecell}

\begin{document}

\begin{table}[h]
\begin{tabular}{|c|c|c|c|c|c|c|c|}
  \hline
\textbf{CENTER THIS} 
    & \textbf{\makecell[t]{Words \\ are here}} 
        & \textbf{\makecell[t]{Blank \\ \#1}} 
            & \textbf{\makecell[t]{Blank \\ \#2}} 
                & \textbf{\makecell[t]{Blank \\ \#3}} 
                    & \textbf{\makecell[t]{Blank \\ \#4}} 
                        & \textbf{\makecell[t]{Blank \\ \#5}} 
                            & \textbf{\makecell[t]{Blank \\ \#6}} \\
  \hline
  Words & \makecell[cc]{Words \\ are here} & {} & {} & {} & {} & {} & {} \\
  \hline
  Words & \makecell[cc]{Words \\ are here} & {} & {} & {} & {} & {} & {} \\
  \hline
\end{tabular}
\end{table}

\end{document}

enter image description here

Edit: From your comment follows, that you after something like this:

enter image description here

\documentclass{article}
\usepackage{makecell}

\begin{document}
    \begin{table}[h]
\renewcommand\cellalign{cc}
\begin{tabular}{|*{8}{c|}}
  \hline
\textbf{CENTER THIS} 
    & \textbf{\makecell{Words \\ are here}}
        & \textbf{\makecell{Blank \\ \#1}}
            & \textbf{\makecell{Blank \\ \#2}}
                & \textbf{\makecell{Blank \\ \#3}}
                    & \textbf{\makecell{Blank \\ \#4}}
                        & \textbf{\makecell{Blank \\ \#5}}
                            & \textbf{\makecell{Blank \\ \#6}} \\
  \hline
  Words & \makecell{Words \\ are here} & {} & {} & {} & {} & {} & {} \\
  \hline
  Words & \makecell{Words \\ are here} & {} & {} & {} & {} & {} & {} \\
  \hline
\end{tabular}
    \end{table}
\end{document}

But you may try make this table with tabularray package. With using it You will get a bit simpler but much shorter code:

\documentclass{article}
\usepackage{tabularray}

\begin{document}
    \begin{table}[h]
\begin{tblr}{hlines, vlines,
             colspec={ *{8}{Q[c, m]} },
             row{1} = {font=\bfseries}
             }
CENTER THIS
        & {Words \\ are here}   & {Blank \\ \#1}
                                     & {Blank \\ \#2}
                                          & {Blank \\ \#3}
                                               & {Blank \\ \#4}
                                                    & {Blank \\ \#5}
                                                         & {Blank \\ \#6}    \\
Words   & {Words \\ are here}   & {} & {} & {} & {} & {} & {} \\
Words   & {Words \\ are here}   & {} & {} & {} & {} & {} & {} \\
\end{tblr}
    \end{table}
\end{document}
2
  • I wanted "CENTER THIS" centered, not "Words". BUT it seems like when I apply the cc to everything on the top row, it works. Thank you! Jul 6 at 17:02
  • @JohanssonMcFleppers, oh I misunderstand where you like to have centered text. I will correct answer ASAP-
    – Zarko
    Jul 6 at 17:13
1

Use \makecell[c] in the other cells of the row.


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{makecell}

\begin{document}

\begin{table}[h]
\begin{tabular}{|c|c|c|c|c|c|c|c|}
  \hline
  \textbf{CENTER THIS} & \textbf{\makecell[c]{Words \\ are here}} & \textbf{\makecell[c]{Blank \\ \#1}} & \textbf{\makecell[c]{Blank \\ \#2}} & \textbf{\makecell[c]{Blank \\ \#3}} & \textbf{\makecell[c]{Blank \\ \#4}} & \textbf{\makecell[c]{Blank \\ \#5}} & \textbf{\makecell[c]{Blank \\ \#6}} \\
  \hline
  Words & \makecell[t]{Words \\ are here} & {} & {} & {} & {} & {} & {} \\
  \hline
  Words & \makecell[t]{Words \\ are here} & {} & {} & {} & {} & {} & {} \\
  \hline
\end{tabular}
\end{table}

\end{document}

enter image description here

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.