3

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

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

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

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.