TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What I want to do is having two or more possibilities when escaping from normal code formatting. For instance, if I give the option escapechar=\⠶ I would like to avoid saying something like this:

double a;
int i; ⠶\color{red}$\longleftarrow$ this is counter $i$⠶

I just want to escape with the given (unusual) character being sure that the color command is automatically given. In other words, the escaped text in the following code:

double a;
int i; ⠶$\longleftarrow$ this is counter $i$⠶

should be in red.

Similarly, instead of this:

double a; £\color{green}$\longleftarrow$ this is the variable $a$£
int i;

I want to escape with the character £ being sure that a green text is typeset.

share|improve this question
Please consider accepting your own answer, so that your question be removed from the "unanswered" pile. – Jubobs Mar 10 '14 at 12:27
up vote 2 down vote accepted

The answer is given by the options escapebegin and escapeend:

double a;
int i; ⠶$\longleftarrow$ this is counter $i$⠶

give a red comment.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.