# “Nice” square brackets

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
$$  & $$  & $$  & $$ \\
$$  & $$  & $$  & $$ \\
\hline
\end{tabular}
\end{document}


I get 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: 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.

• 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/…. – CampanIgnis Jul 23 '18 at 22:44
• \left and \right are wrong here and  is correct, however, that's just good general advice,  won't make any difference when it comes to your problem – Au101 Jul 23 '18 at 22:45
• Please tell us which font you're using. – Mico Jul 23 '18 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. – barbara beeton Jul 27 '18 at 18:34

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: ## Code:

\documentclass{article}
\usepackage{graphicx}

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

\newcommand{\TightBracketA}{\raisebox{0.25ex}{\scalebox{0.8}{\boldmath${#1}$}}}%
\newcommand*{\TightBoxA}{\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}
{"ft_lang_label":"__label__en","ft_lang_prob":0.84714633,"math_prob":0.9912285,"size":1236,"snap":"2020-34-2020-40","text_gpt3_token_len":338,"char_repetition_ratio":0.09577922,"word_repetition_ratio":0.03076923,"special_character_ratio":0.27750808,"punctuation_ratio":0.08888889,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9769845,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,3,null,3,null,3,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-08-07T19:07:37Z\",\"WARC-Record-ID\":\"<urn:uuid:6f2a2657-d64b-470f-8340-1ecdc1eb9bab>\",\"Content-Length\":\"152698\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:44d4b66c-2a57-4956-b4a0-a2344187531e>\",\"WARC-Concurrent-To\":\"<urn:uuid:bafc1b23-5799-4e9a-88e5-c8b21cbf1b3e>\",\"WARC-IP-Address\":\"151.101.129.69\",\"WARC-Target-URI\":\"https://tex.stackexchange.com/questions/442935/nice-square-brackets\",\"WARC-Payload-Digest\":\"sha1:JFSAV7AOTYRJ3RI66WC5U3FCZ4MARPW2\",\"WARC-Block-Digest\":\"sha1:GQWOENSGYF2HQJGP6ZNBXZBPH5YNSII6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-34/CC-MAIN-2020-34_segments_1596439737206.16_warc_CC-MAIN-20200807172851-20200807202851-00343.warc.gz\"}"}