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 my country, instead of tan, we use tg (this is just one of them). I want to be able to type


and possibly


So that Latex recognizes them. I tried defining them like this:


That seemed to work until I used in a block of bold text and it was bold as well, while \sin and \cos where not bold. So how can I define them correctly?


I use this new operator in math blocks, like

The use of $ \tg{x} $

Or even in \subsection (which has a bold formatting in my document):

\subsection{The use od $ \tg{x} $}
share|improve this question
don't use \text (it will use the right \mathrm font automatically) – David Carlisle Jan 28 at 20:39
@DavidCarlisle then what? – Victor Jan 28 at 20:40
then it'll work as you intended, just like \sin so \DeclareMathOperator{\tg}{tg} – David Carlisle Jan 28 at 20:42
@jfbu I suppose you've gone off on a tangent? :) – Arun Debray Jan 28 at 21:58
According to Cajori, the abbreviation “tan” was used by Finck in 1583; Euler used “tang”, but sometimes “tg”. In the 18th century, “tang” and “tan” were probably the most used abbreviations. A table in the book by Cajori seems to show that “tg” is more German than French; for instance, Legendre and Cauchy used “tang”. – egreg Jan 28 at 22:07
up vote 14 down vote accepted

All you need to do is write \DeclareMathOperator{\tg}{tg}; this defines the command \tg to use the normal math font. Then, you can define \tgx to just be \tg x:

\newcommand{\tgx}{\tg x}
In a paragraph of normal text, $\sin x$, $\cos x$, $\tg x$, and $\tgx$.

In a paragraph of bold text, $\sin x$, $\cos x$, $\tg x$, and $\tgx$.

enter image description here

share|improve this answer

If you are typing in Spanish, load \usepackage[spanish]{babel} and you will have it available.

share|improve this answer
It's Romanian actually :) – Victor Jan 28 at 20:42
Argh, I didn't know it was used elsewhere. – Manuel Jan 28 at 20:43
it used to be in use in France, but sadly we are not as robust as the Romanians ! – jfbu Jan 28 at 21:30

When you declare a math operator, you should do so without specifying it as being formatted as \text. There is no mention of this requirement in the amsmath user guide (section 5.1 Defining new operator names):

To define a math function \xxx to work like \sin, you write


whereupon ensuing uses of \xxx will produce xxx in the proper font and automatically add proper spacing on either side when necessary, ...

enter image description here





$\sin^2\theta + \cos^2\theta = 1$

$\tg^2\theta + \cos^2\theta = 1$

{\bfseries $\tg^2\theta + \cos^2\theta = 1$}

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.