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

In some times I have to set a tag in front of a text math formula. It seems better to define a command \TAG, as $\TAG{Pythagoras' Equation}a^2+b^2=c^2$ to get <Pythagoras' Equation> a^2+b^2=c^2. The \TAG command need fit several conditions:

  1. give a convenience to change the l(r)angle globally;
  2. the content could be broken down, but do not at left angle;
  3. it'd better be put in math mode.

Of course the amsmath \tag command might be modified to suit my demand, but I don't know how to do.

@ TH.: O.K.

  1. Think about an onerous editor who likes green color than black or a pair of parenthese than a pair of angle.
  2. When the content of \TAG is very long, it cannot overlap the right margin, and its suitable break line point mustn't at the left delimiter as most of people want.
  3. The command is in math mode, so it can be affected by \mathsurround, \everymath, etc.

add an image http://i.stack.imgur.com/ZUgVk.png

share|improve this question
I don't understand your requirements. Can you give more explanation of what you want? – TH. Mar 14 '11 at 8:22

Here is a \TAG macro that sets its content (assumed to be text) in a parbox of a specifiable width as a tag between customizable delimiters:

\TAG{Pythagoras' Equation}a^2+b^2=c^2
\TAG{Theory of life, the universe, and everything}
6 \times 9 = 42

enter image description here

share|improve this answer
Hey friend, I need use the command in text mode, but not in display math mode; and I want it appear in front of formula. – user4169 Mar 14 '11 at 15:00
  $% get out of math mode
  \kern-\mathsurround % get rid of \mathsurround
  \textlangle % start the tag
  \nobreak\hspace{0pt}\textup{#1}% typeset the tag
  \textrangle % end the tag
  ~% insert a non breakable interword space
  \kern-\mathsurround % get rid of \mathsurround
  $% restart the formula

The definitions of \textlangle and \textrangle are just for convenience. This works even if you insert formulas with \(...\) or \begin{math}...\end{math}.

share|improve this answer

Your Answer


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