# how to write tan inverse function

I want to write tan inverse function in my latex. I need to write tan inverse as it is and not as arctan. what is the code for that? I need to write an equation theta = tan inverse (x/y).

With amsmath, add \DeclareMathOperator{\taninv}{tan\,inverse} in the preamble and in the text use \taninv.

Example code:

\documentclass{article}
\usepackage{amsmath}

\DeclareMathOperator{\taninv}{tan\,inverse}

\begin{document}

\begin{equation*}
\theta=\taninv\frac{x}{y}
\end{equation*}

\end{document}


I've never seen such a notation. However, if you later want to stick to more common notation, it's sufficient you change the line into

\DeclareMathOperator{\taninv}{arctan}


or

\newcommand{\taninv}{\tan^{-1}}

• If I use \DeclareMathOperator{\taninv}{tan^{-1}}, then the -1 bit appears as it would in text mode rather than in math mode (so it minus is a bit short, like a dash). Is there a way to fix this so the minus sign appears as it would in math mode? Jul 12, 2019 at 12:15
• @JohnDoe Ah! Another reason for not using “tan^{-1}”, which is also mathematically wrong. I'll fix the code. Jul 12, 2019 at 14:08
• Ahh, that's not actually the mistake I was referring to! This is what I mean. In the first one, I uses \taninv where \taninv is defined as \tan^{-1}. In the second one, I just wrong \tan^{-1} in the document (without defining a new operator). My question is, is there a way to replicate the second one by defining the an operator? Jul 12, 2019 at 14:48
• @JohnDoe \tan is an operator and remains such if you append a superscript. Jul 12, 2019 at 14:58
• @JohnDoe Doesn't \newcommand{\atan}{\tan^{-1}} do what you're looking for? With it, typing \atan or \tan^{-1} will yield the same exact result. Jul 12, 2019 at 16:11