4

How can I put special characters like the square brackets into a keys{} provided by the menukeys package?

I tried it with \[ and \] respectively, but it fails. Unlike for the | character there does not seem to be a symbol I can reference by name (see below) that will work inside the \keys{} command.

I only list the characters I tried below, but I'm generally interested in how I can approach such a problem when I encounter it.

How can I address my specific problem and what would be the steps to take next time I encounter a similar problem (short of asking here).


The characters that I'm interest and found to fail so far (including what I tried):

  • [ as \[
  • ] as \]

Working in escaped or other form:

  • | \textbar (not working: \vbar, \| and {\|})
  • % via \%
  • & via \&
  • # via \#
  • { via \{ and \textbraceleft
  • } via \} and \textbraceright

1 Answer 1

5

The commands you are looking for are \lbrack and \rbrack, althought using {[} and {]} also works (as was predicted by barbara beeton in her comment):

\documentclass{article}
\usepackage{menukeys}

\begin{document}

\menu[,]{\{,\},\%,\#,\lbrack,\rbrack,{[},{]}}

\end{document}

enter image description here

Useful resources to find commands for symbols:

4
  • thanks, these work. As it turns out, though, even though I was using an old version (2003) of the comprehensive symbol list, it is not included in this list. \lBrack is, but \lbrack is not. Also, I was naturally looking for bracket and "around" the location where \textbraceleft and friends were to be found. Thanks again for your time. Commented Jun 19, 2015 at 15:55
  • 1
    i didn't try it, but might {[} and {]} work as well? (i'm guessing that "unprotected" [ may be getting interpreted as introducing an option. if that's the case than braces around ] wouldn't really be needed, but it's easier to remember if input is handled symmetrically.) Commented Jun 19, 2015 at 15:57
  • @0xC0000022L I've updated my answer with another option. Commented Jun 19, 2015 at 16:08
  • @barbarabeeton you're prediction was corrcet. I've updated my answer. Thanks. Commented Jun 19, 2015 at 16:08

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.