Square brackets inside square brackets in LaTeX

Problem:
When using a table of contents for images, you may specify the alternative caption inside square brackets, for example:

\caption[This is the text that goes on the index]{This is the text that goes right on the image}

But what if my alternative text has a square bracket, like “[test]”? (The reason I need this is long history, but has to do with bibunit :))

Solution:
The solution I found is to put it inside curly braces, for example:

\caption[This is the text that goes on the index {[test]}]{This is the text that goes right on the image}
Advertisements

One thought on “Square brackets inside square brackets in LaTeX”

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s