TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

I'm translating some text that use the comment package, it's usage seems like that:

 ... some English text

... corresponding Chinese text

By using \excludecommand{en} or \includecommand{en} before \begin{document}, we can control the text out or in the final PDF document.

But this too trouble to add \begin{}/\end{} for every paragraph, what I want is following:

 ... some English text

... corresponding Chinese text

this is much more simple to type. and I create the commands like this:


But this cause compile error like runaway argument, how to make it work under this situation by using newcommand?

share|improve this question
You can try \let\OldEn\en and use \OldEn, instead of \begin{en} and \enden, instead of \end{en}. Also, while code snippets are useful in explanations, it is always best to compose a fully compilable MWE that reproduces the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Mar 19 '14 at 14:18
I think the best way to do things would be to keep the environments and to configure your editor so that with a shortcut it typesets the environment and puts the cursor in the middle. – Bernard Mar 19 '14 at 14:27
Note that not all environments can be turned into commands (anything with verbatim or ams alignments will cause trouble at least) also in a large document it is a lot easier to see matching begin/end than working out what is ended by } any reasnobel editor shoudl allow you to enter \begin{en} \end{en} with 1 or 2 keystrokes – David Carlisle Mar 19 '14 at 14:28
You can't: The comment environment is looking for the string \end{en} while skipping over the rest of the text. Also it is problematic to put large portions of text in an argument: You can't change catcodes there and so a lot of things (e.g. verbatim) are not possible. – Ulrike Fischer Mar 19 '14 at 14:29
@Bernard: what I'm planning is sed or awk... – coanor Mar 19 '14 at 14:29

The problem is that you are trying to redefine an existing command \en which gets defined when the en environment is defined (as does \enden). The solution to redefine most environments is to first save the definition of xxx as \OldXxx:


and then redefine the \xxx macro using \OldXxx and \endxxx:


enter image description here


  • As per the comments, this won't work with any verbatim type of environments.




 \ldots some English text in environment


\en{\ldots some more English text in macro \ldots}

share|improve this answer

Use just one other character for the command:



%\renewcommand\Zh[1]{} %%% enable if it should be excluded
%\renewcommand\En[1]{} %%% enable if it should be excluded

\En{ \ldots some English text in environment (En)}

\Zh{ \ldots some more English text in macro \ldots (Zh)}

share|improve this answer
It works but with the \includecommand{Zh}/\excludecommand{En}, why? – coanor Mar 19 '14 at 15:04
You can simply redefine the command as empty. Then it throws its argument away. See my edited answer. – Herbert Mar 19 '14 at 15:23

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.