1

I'm looking for how to add a bottom square bracket (looks like this: ⎵) in latex (Overleaf specifically although I don't believe it should be different?).

According to Entering Unicode characters in LaTeX, this should work and is what I currently have:

\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{9141}{\bottomsquarebracket} % 9141 is 23B5 in decimal
...
\begin{document}
...
This is a bottom square bracket: \bottomsquarebracket
...
\end{document}

When compiled, I just get the text "This is a bottom square bracket: " as if the \bottomsquarebracket wasn't there at all.

I'm open to changing my code entirely if there is another way to do this.

imnothere
  • 14,215
NyW
  • 13

1 Answers1

3

Depending on what you want it for, the visible space character from the cmtt fonts might be appropriate. You can access it with \texttt{\verbvisiblespace}¹

In the context of producing code that shows this symbol with spaces you can use \verb* or the verbatim* environment which work just like their non-* counterparts, but use the visible space character where spaces appear.

Also

You're using \DeclareUnicodeCharacter wrong. The first argument should be hex so the correct value to enter there is 23B5 and not 9141, and it's for mapping a Unicode input character to a LaTeX control sequence, not the inverse.

What you really want to do is use

\DeclareTextSymbol{\bottomsquarebracket} \UnicodeEncodingName{"23B5}

  1. \verbvisiblespace is one of those odd cases where commands work differently between pdfLaTeX and XeLaTeX/LuaLaTeX. On the former, it will, not give the expected results without the \texttt but on the latter, the \texttt is redundant.
Don Hosek
  • 14,078
  • \verbvisiblespace should work with \usepackage[T1]{fontenc} in pdflatex, without the need for \texttt. – imnothere May 24 '21 at 03:51
  • That's possible (I only looked at source2e.pdf). Vanilla LaTeX, though, defines \DeclareRobustCommand\asciispace{\char 32 } and for pdfLaTeX has \let\verbvisiblespace\asciispace – Don Hosek May 24 '21 at 03:55
  • There's actually a fair amount of fiddling to make sure that whatever \verbvisiblespace is defined as, if it's not \asciispace, doesn't mess up spacing... part of the legacy of UTF8 being grafted onto a system that doesn't inherently support it. – Don Hosek May 24 '21 at 03:58