# How can I center mathematical symbols in table?

I want to center the arrows as well as the \vdots, but can't figure out how. I want to create a figure, but thought the smartest way to do it is to create it as an table. Any help would be appreciated! (As a bonus question: How do I center "Cal-23"?).

\documentclass[12pt]{book}

\usepackage[]{graphicx}
\usepackage[]{color}
\usepackage{alltt}

\usepackage[a4paper, width = 160mm, top = 35mm, bottom = 30mm,
bindingoffset = 0mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{ragged2e}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{tabularray}
\usepackage{tabularx}

\begin{document}

\begin{table}
\centering
\begin{tblr}{
cell{1}{6} = {c=2}{},
vline{1,13} = {1}{},
vline{1,4,7,10,13} = {3}{},
vline{1-4,7,10,13} = {5}{},
vline{4-7,10,13} = {7}{},
hline{1-8} = {-}{},
hspan = even,
}
&        &        &        &        & Cal-23  &  &        &  &  &        &  \\
& $\downarrow$  &        &        & $\downarrow$  &         &  & $\downarrow$  &  &  & $\downarrow$  &  \\
& Q1/23  &        &        & Q2/23  &         &  & Q3/23  &  &  & Q4/23  &  \\
$\downarrow$  & $\downarrow$  & $\downarrow$  &        & $\downarrow$  &         &  & $\downarrow$  &  &  & $\downarrow$  &  \\
Jan/23 & Feb/23 & Mar/23 &        & Q2/23  &         &  & Q3/23  &  &  & Q4/23  &  \\
&        &        & $\downarrow$  & $\downarrow$  & $\downarrow$   &  & $\downarrow$  &  &  & $\downarrow$  &  \\
&        &        & Apr/23 & May/23 & Jun/23 &  & Q3/23  &  &  & Q4/23  &  \\
&        &        &        &        &         & $\vdots$ & $\vdots$ & $\vdots$ &  & $\vdots$ &
\end{tblr}
\end{table}

\end{document}


• you can centre all cells with e.g. cells={halign=c}

• to centre Cal-23 either place it in the cell in the middle of your columns, or merge all cells in this row together:

\documentclass[12pt]{book}

\usepackage[]{graphicx}
\usepackage[]{color}
\usepackage{alltt}

\usepackage[a4paper, width = 160mm, top = 35mm, bottom = 30mm,
bindingoffset = 0mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{ragged2e}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{tabularray}
\usepackage{tabularx}

\begin{document}

\begin{table}
\centering
\begin{tblr}{
cell{1}{6} = {c=2}{},
vline{1,13} = {1}{},
vline{1,4,7,10,13} = {3}{},
vline{1-4,7,10,13} = {5}{},
vline{4-7,10,13} = {7}{},
hline{1-8} = {-}{},
hspan = even,
cells={halign=c}
}
\SetCell[c=12]{} Cal-23 &        &        &        &        &   &  &        &  &  &        &  \\
& $\downarrow$  &        &        & $\downarrow$  &         &  & $\downarrow$  &  &  & $\downarrow$  &  \\
& Q1/23  &        &        & Q2/23  &         &  & Q3/23  &  &  & Q4/23  &  \\
$\downarrow$  & $\downarrow$  & $\downarrow$  &        & $\downarrow$  &         &  & $\downarrow$  &  &  & $\downarrow$  &  \\
Jan/23 & Feb/23 & Mar/23 &        & Q2/23  &         &  & Q3/23  &  &  & Q4/23  &  \\
&        &        & $\downarrow$  & $\downarrow$  & $\downarrow$   &  & $\downarrow$  &  &  & $\downarrow$  &  \\
&        &        & Apr/23 & May/23 & Jun/23 &  & Q3/23  &  &  & Q4/23  &  \\
&        &        &        &        &         & $\vdots$ & $\vdots$ & $\vdots$ &  & $\vdots$ &
\end{tblr}
\end{table}

\end{document}


• Thank you so much, I unfortunately don't have enough reputation to give you an upvote, but i will mark the question as answered in a couple of minutes :) Sep 8 at 15:32
• @testtest You're wedlcome! Sep 8 at 15:33

The MMM/23 tags don't fit in one twelfth of the line width, so you cannot get equal size for twelve columns.

\documentclass[12pt]{book}
\usepackage[
a4paper,
width = 160mm,
top = 35mm,
bottom = 30mm,
bindingoffset = 0mm,
]{geometry}
\usepackage{array}

\begin{document}

\begin{table}[htp]

\setlength{\tabcolsep}{0pt}

\begin{tabular}{*{12}{w{c}{\dimeval{(\textwidth-7\arrayrulewidth)/12}}}}
\hline
\multicolumn{12}{|c|}{Cal-23} \\
\hline
\multicolumn{3}{c}{\textdownarrow} &
\multicolumn{3}{c}{\textdownarrow} &
\multicolumn{3}{c}{\textdownarrow} &
\multicolumn{3}{c}{\textdownarrow} \\
\hline
\multicolumn{3}{|c|}{Q1/23} &
\multicolumn{3}{c|}{Q2/23} &
\multicolumn{3}{c|}{Q3/23} &
\multicolumn{3}{c|}{Q4/23} \\
\hline
\textdownarrow &
\textdownarrow &
\textdownarrow &
\multicolumn{3}{c}{\textdownarrow} &
\multicolumn{3}{c}{\textdownarrow} &
\multicolumn{3}{c}{\textdownarrow} \\
\hline
\multicolumn{1}{|c|}{01/23} &
\multicolumn{1}{c|}{02/23} &
\multicolumn{1}{c|}{03/23} &
\multicolumn{3}{c|}{Q2/23} &
\multicolumn{3}{c|}{Q3/23} &
\multicolumn{3}{c|}{Q4/23} \\
\hline
&&&
\textdownarrow &
\textdownarrow &
\textdownarrow &
\multicolumn{3}{c}{\textdownarrow} &
\multicolumn{3}{c}{\textdownarrow} \\
\cline{4-12}
&&&
\multicolumn{1}{|c|}{04/23} &
\multicolumn{1}{c|}{05/23} &
\multicolumn{1}{c|}{06/23} &
\multicolumn{3}{c|}{Q3/23} &
\multicolumn{3}{c|}{Q4/23} \\
\cline{4-12}
&&&&&& \vdots & \vdots & \vdots && \vdots &
\end{tabular}

\end{table}

\end{document}


The page number at the top shows that the full text width is used. The “mysterious” -7\arrayrulewidth is due to the fact that the maximum number of vertical rows is seven, in the third row (excluding the one with arrows).

For information, here is a way to construct that table with {NiceTAbular} of nicematrix. You need several compilations.

\documentclass[12pt]{book}
\usepackage{alltt}
\usepackage[a4paper, width = 160mm, top = 35mm, bottom = 30mm,
bindingoffset = 0mm]{geometry}
\usepackage{nicematrix}

\begin{document}

\begin{table}
\centering
\newcommand{\One}{\Block[draw]{}}
\newcommand{\Three}{\Block[draw]{1-3}}
\newcommand{\Ar}{$\downarrow$}
\renewcommand{\arraystretch}{1.2}
\begin{NiceTabular}{*{8}{X[c]}}
\Block[draw]{1-*}{Cal-23} \\
& \Ar &&& \Ar && \Ar & \Ar \\
\Three{Q1/23} &&& \Three{Q2/23} &&& \One{Q3/23} & \One{Q4/23} \\
\Ar & \Ar & \Ar & & \Ar & & \Ar & \Ar \\
\One{Jan/23} & \One{Feb/23} & \One{Mar/23} & \Three{Q2/23} &&& \One{Q3/23} & \One{Q4/23} \\
& & & \Ar & \Ar & \Ar & \Ar & \Ar \\
\Block[borders={top,bottom}]{1-3}{}
&&& \One{Apr/23} & \One{May/23} & \One{Jun/23} & \One{Q3/23} & \One{Q4/23}
\end{NiceTabular}
\end{table}

\end{document}