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

How can I use **xyz** or another similar one instead of \foo{xyz} or \foo*{xyz}?

note: question is updated to reflect my concern, question is general and is not depended on a special package. You may use **xyz** form for any other command

share|improve this question
I'm sure that on this site there's an answer about a very similar question. However, I don't see how the input **xyz** could be preferred to \lr{xyz}. – egreg May 26 '12 at 8:38
Although, one simple solution is to define * character active, and assign a macro to it. – Hasan Zakeri May 26 '12 at 9:25
I've found the answer I was referring to: tex.stackexchange.com/a/15374 – egreg May 26 '12 at 9:41
@ Hassan Zakeri. Thanks, But the question is general and is not depended on XePersian directly. You may use **x** form for any other command. – PHPst May 26 '12 at 12:32
If you are using luatex, then this approach for multiline comments can be easily adapted to your case. (Just add \foo{ and } at the beginning at the end of each match, and don't delete the intermediate text). Since this parses the text when the file is read, it does not suffer from any of the drawback of active characters. – Aditya May 27 '12 at 9:36

For converting some general input syntax **text** into \foo{text} or \foo*{text}, the approach outlined in this answer to Will two-letter font style commands (\bf , \it , …) ever be resurrected in LaTeX? can be used. However, such an approach is prone to serious issues, particularly if you choose ** as your 'active' component. This will break any other use of *, as it relies on an active character. As such, while the link is suitable for working with pure Markdown or some other 'foreign' input, it is not recommended at all for inter-mixing with standard LaTeX input.

share|improve this answer
For instance, one can change *text* into \foo{text} and **text** into \foo*{text}; but using \section* would require \expandafter\section\string* which doesn't seem very handy; the same for any other command with a *-form. – egreg May 26 '12 at 16:08
This more looks like a comment rather than a real answer. – Simurgh12 May 27 '12 at 0:20
@Simurgh12 To me an answer here has two parts: the technical part and the conceptual. We already have an answer on the site which deals with the technical part, but in another context. Hence this question is not a dupe, but repeating the information seems somewhat redundant. The conceptual part (that this is not a good idea) is to me part of an answer. I can of course add a small code example if the OP would like one. – Joseph Wright May 27 '12 at 6:49
@JosephWright Thanks, Can you please add a code example (Example of issues that may occurred)? – PHPst Jul 23 '12 at 6:31

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.