4

Hello I am looking to improve the equality of these colorboxes. You can see the difference in the dimensions of the shading. I tried the \strut command but it changed the table too much. This is the best I could do. Please help in finding a solution.

\documentclass{article}
\usepackage{amsmath,xcolor}
\begin{document}
\[ \begin{tabular}{c|c}
\hline
\textbf{Factors of}\ \color{blue}{$\mathbf{6}$}\color{black}{} & \textbf{Sum 
of Factors}\\ \hline
$1,6$ & $7$ \\ \hline
${\setlength{\fboxsep}{1.5pt}\colorbox{brown!50!white}{2,3}}$ &  
${\setlength{\fboxsep}{1.5pt}\colorbox{brown!50!white}{6}}$ \\ \hline 
\end{tabular} \]
\end{document}

enter image description here

1
  • 4
    If you add a \vphantom{,} in the second you will have the same dimensions.
    – koleygr
    Sep 20, 2018 at 4:19

1 Answer 1

4

your problem is solved by koleygr's comment, so i add some off-topic suggestion for your code:

\documentclass{article}
\usepackage{amsmath,xcolor}

\begin{document}
\[ \setlength{\fboxsep}{1.5pt}
    \begin{tabular}{c|c}
    \hline
\textbf{Factors of \textcolor{blue}{6}} 
        & \textbf{Sum of Factors}                   \\ 
    \hline
1,6     &   7                                       \\ 
    \hline
\colorbox{brown!50!white}{2,3}  
        & \colorbox{brown!50!white}{5\vphantom{,}}  \\  % <--- as suggested koleygr
    \hline
\end{tabular} 
\]
\end{document}

enter image description here

You must log in to answer this question.

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