Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

66%
+2 −0
Q&A Syntax summaries use brackets for optional elements; how do I represent literal brackets in a way readers will understand?

A fairly common solution I've seen to issues like this is to use different font faces for literal text and meta-notation. Often it will be a monospace "teletype" or sans-serif font for literal text...

posted 4y ago by Derek Elkins‭  ·  edited 4y ago by Derek Elkins‭

Answer
#2: Post edited by user avatar Derek Elkins‭ · 2020-12-21T03:29:08Z (about 4 years ago)
Note that the styles are not rendered.
  • A fairly common solution I've seen to issues like this is to use different font faces for literal text and meta-notation. Often it will be a monospace "teletype" or sans-serif font for literal text and a contrasting (usually lighter) variable width font for meta-notation.
  • For your example, you'd get:
  • <span style="font-family: monospace">ARRAY[</span> *data-type*[ <span style="font-family: monospace">,</span> *count*] <span style="font-family: monospace">]</span>
  • In case that doesn't render well, here are compromise mimics using `code`:
  • `ARRAY[`*data-type*[`,` *count*]`]`
  • or **bold**:
  • **ARRAY[** *data-type*[ **,** *count*] **]**
  • Other text decorations such as underlining could be used to make it clear what is literal text. I've mostly seen this in older hand-typed documents.
  • As you can tell from the examples, it is easy to distinguish the literal brackets from the meta-brackets.
  • Whatever the approach, it would be explicitly documented in the early part of the documentation but is often intuitive enough even if someone skips that explanation.
  • A fairly common solution I've seen to issues like this is to use different font faces for literal text and meta-notation. Often it will be a monospace "teletype" or sans-serif font for literal text and a contrasting (usually lighter) variable width font for meta-notation.
  • For your example, you'd get:
  • <span style="font-family: monospace">ARRAY[</span> *data-type*[ <span style="font-family: monospace">,</span> *count*] <span style="font-family: monospace">]</span>
  • In case that doesn't render well, here are compromise mimics using `code`:
  • `ARRAY[`*data-type*[`,` *count*]`]`
  • or **bold**:
  • **ARRAY[** *data-type*[ **,** *count*] **]**
  • (Indeed, the static renderer strips the style attributes making the first example pointless. If you edit the answer, you will see the intended effect in the preview.)
  • Other text decorations such as underlining could be used to make it clear what is literal text. I've mostly seen this in older hand-typed documents.
  • As you can tell from the examples, it is easy to distinguish the literal brackets from the meta-brackets.
  • Whatever the approach, it would be explicitly documented in the early part of the documentation but is often intuitive enough even if someone skips that explanation.
#1: Initial revision by user avatar Derek Elkins‭ · 2020-12-21T03:25:45Z (about 4 years ago)
A fairly common solution I've seen to issues like this is to use different font faces for literal text and meta-notation. Often it will be a monospace "teletype" or sans-serif font for literal text and a contrasting (usually lighter) variable width font for meta-notation.

For your example, you'd get:

<span style="font-family: monospace">ARRAY[</span> *data-type*[ <span style="font-family: monospace">,</span> *count*] <span style="font-family: monospace">]</span>

In case that doesn't render well, here are compromise mimics using `code`:

`ARRAY[`*data-type*[`,` *count*]`]`

or **bold**:

**ARRAY[** *data-type*[ **,** *count*] **]**

Other text decorations such as underlining could be used to make it clear what is literal text. I've mostly seen this in older hand-typed documents.

As you can tell from the examples, it is easy to distinguish the literal brackets from the meta-brackets.

Whatever the approach, it would be explicitly documented in the early part of the documentation but is often intuitive enough even if someone skips that explanation.