How do you write hyperbolic functions in LaTeX?

Click For Summary

Discussion Overview

The discussion revolves around writing hyperbolic functions in LaTeX, specifically focusing on the secant, cosecant, and cotangent hyperbolic functions. Participants explore issues related to undefined control sequences and potential solutions, including the use of macros and packages.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant inquires about the LaTeX code for hyperbolic functions and reports an error with \sech, \csch, and \coth.
  • Another participant suggests using \text{sech} and creating macros, noting that these are not standard LaTeX commands except for \coth.
  • A participant expresses uncertainty about the undefined control sequence error when using \text{} within an {eqnarray*} environment.
  • Another participant mentions that \coth works for them and speculates that the issue may be related to spacing between the command and its argument.
  • One participant proposes creating new commands in the preamble to define the hyperbolic functions, emphasizing the use of \mathrm for font consistency and spacing.
  • A later reply suggests using \DeclareMathOperator if the amsmath package is being used, indicating an alternative approach to defining the functions.

Areas of Agreement / Disagreement

Participants express differing views on the best approach to writing hyperbolic functions in LaTeX, with no consensus on a single solution. Some agree on the utility of creating macros, while others discuss specific issues related to environments and spacing.

Contextual Notes

Participants mention potential issues with certain LaTeX environments and the need for proper spacing, but do not resolve the underlying causes of the errors encountered.

mathemagician
Hi! How do you write the LaTeX code for the secant, cosecant, and cotangent hyperbolic functions?

I tried using \sech, \csch, and \coth but I am getting an error when I run the latex program. It is giving me a undefiend control sequence message? Is there a package I need to include in my .tex file to have those hyperbolic functions?

Thanks
 
Physics news on Phys.org
just use \text{sech} and so on. you could create your own macro too. these aren't latex commands you see, though the coth one is supposed to be.

rather than search for a package that may have them and probably won't install easily just create the macros in your preamble
 
matt grime said:
just use \text{sech} and so on. you could create your own macro too. these aren't latex commands you see, though the coth one is supposed to be.

rather than search for a package that may have them and probably won't install easily just create the macros in your preamble

Thanks. I think I sort of jumped to conclusions with the coth. However, I still get an undefined control sequence error using \text{}. Does it matter it being used within an {eqnarray*} ?
 
mathemagician said:
Hi! How do you write the LaTeX code for the secant, cosecant, and cotangent hyperbolic functions?

I tried using \sech, \csch, and \coth but I am getting an error when I run the latex program. It is giving me a undefiend control sequence message? Is there a package I need to include in my .tex file to have those hyperbolic functions?

Thanks
\coth x works for me... I'm not using \text. Maybe you left no space between coth and the argument...
 
as he says, he's got coth to work.

i don't know why it's not working in an eqnarray* (though I wouldn't put the braces there ). Some environments have problems if \ is the first character of an entry in some slot, you could try typing {\text{sech}}
 
The other way around this problem, especially if using the command several times, is to create a new command in the preamble.

\newcommand{\sech}{\mathrm{sech} \,}

And similar for the others. The \mathrm will ensure it's written in normal font and the \, will make sure there is a gap between the function and variable.

Adrian.
 
If you're using amsmath, an even better way is to use \DeclareMathOperator.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
14
Views
6K
  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K