2

I am trying to get square brackets to fit "nicely" around a number (for denoting the equivalence class containing that number). Using the following,

\begin{document}
\renewcommand{\arraystretch}{2}
\renewcommand{\tabcolsep}{0.3cm}
\begin{tabular}{|c|ccc|}
\hline
$[0]$  & $[0]$  & $[1]$  & $[2]$ \\
$[1]$  & $[1]$  & $[2]$  & $[3]$ \\
\hline
\end{tabular}
\end{document}

I get

enter image description here

There is superfluous whitespace under the numbers inside the brackets, which looks a bit jarring in a large table containing a lot of expressions like these. I would prefer something like this:

enter image description here

Notice how there is no superfluous whitespace under the numbers inside the brackets. I know that brackets can be made taller with \bigl and such. Is there a similar way to make brackets shorter, or fit nicely around a number?

I used the default Computer Modern font. The ssecond example comes from a textbook typeset in Latex with the Gyre Schola font.

4
  • This question might be simpler to answer with a MWE, see tex.meta.stackexchange.com/questions/228/…. You could choose a different typeface or replace the the brackets with brackets from another typeface as done in tex.stackexchange.com/questions/386928/…. Jul 23, 2018 at 22:44
  • \left and \right are wrong here and [1] is correct, however, that's just good general advice, [1] won't make any difference when it comes to your problem
    – Au101
    Jul 23, 2018 at 22:45
  • Please tell us which font you're using.
    – Mico
    Jul 23, 2018 at 22:57
  • the delimiters in the computer modern fonts are designed to be appropriate for more variable math environments, where often the material to be placed inside includes descenders, as on "p", "q", "y", or "\chi", as well as operator symbols centered vertically on the math axis. it's a different requirement. Jul 27, 2018 at 18:34

1 Answer 1

3

One way would be to use the graphicx package to scale the square brackets and use \boldmath to get slightly thicker brackets. Furthermore, you can combine this with a \kern and double up the brackets to get slightly thicker brackets:

enter image description here

Code:

\documentclass{article}
\usepackage{graphicx}

\newcommand{\TightBracketB}[1]{\raisebox{0.25ex}{\scalebox{0.8}{\boldmath${#1\kern-0.65ex#1}$}}}%
\newcommand*{\TightBoxB}[1]{\TightBracketB[#1\TightBracketB]}

\newcommand{\TightBracketA}[1]{\raisebox{0.25ex}{\scalebox{0.8}{\boldmath${#1}$}}}%
\newcommand*{\TightBoxA}[1]{\TightBracketA[#1\TightBracketA]}


\begin{document}
\renewcommand{\arraystretch}{1.25}
\renewcommand{\tabcolsep}{0.3cm}
\begin{tabular}{|c|cccc|}
\hline
$\TightBoxA{0}$  & $\TightBoxA{1}$  & $\TightBoxA{2}$  & $\TightBoxA{3}$ & $\TightBoxA{4}$ \\
$\TightBoxA{5}$  & $\TightBoxA{6}$  & $\TightBoxA{7}$  & $\TightBoxA{8}$ & $\TightBoxA{9}$ \\
\hline
\end{tabular}

\begin{tabular}{|c|cccc|}
\hline
$\TightBoxB{0}$  & $\TightBoxB{1}$  & $\TightBoxB{2}$  & $\TightBoxB{3}$ & $\TightBoxB{4}$ \\
$\TightBoxB{5}$  & $\TightBoxB{6}$  & $\TightBoxB{7}$  & $\TightBoxB{8}$ & $\TightBoxB{9}$ \\
\hline
\end{tabular}
\end{document}

You must log in to answer this question.

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