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

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





enter image description here

Useful resources to find commands for symbols:

| improve this answer | |
  • 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. – 0xC0000022L Jun 19 '15 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.) – barbara beeton Jun 19 '15 at 15:57
  • @0xC0000022L I've updated my answer with another option. – Gonzalo Medina Jun 19 '15 at 16:08
  • @barbarabeeton you're prediction was corrcet. I've updated my answer. Thanks. – Gonzalo Medina Jun 19 '15 at 16:08

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.