1
$\begingroup$

MathJax does not work for hyperbolic $ \sech \,x$... Can it be now included? Thanks in advance.

EDIT1:

From user1729's comment suggestion, they work okay:

$$\operatorname{sech}(x) $$

$$ \DeclareMathOperator{\sech}{sech} $$

$$\sech (y)$$

$\endgroup$
10
  • $\begingroup$ Somewhat related older discussions: Can custom TeX/MathJax commands be defined by default for a site? and $\LaTeX$ shortcuts. (Perhaps also Personalised $\LaTeX$ commands for users and Specific Latex commands for user's account.) $\endgroup$ Commented Jan 14, 2020 at 21:39
  • $\begingroup$ Do you know that you can define it manually? \operatorname{sech}(x) renders as $\operatorname{sech}(x)$. $\endgroup$
    – user1729
    Commented Jan 15, 2020 at 9:40
  • 1
    $\begingroup$ Also, you can use \DeclareMathOperator{\sech}{sech}$\DeclareMathOperator{\sech}{sech}$ to define it everywhere in your post. So typing sech(x) now gives $\sech(x)$. (There is a way, or used to be a way, to define commands for a whole page, but I can't remember it at the moment.) $\endgroup$
    – user1729
    Commented Jan 15, 2020 at 9:44
  • 1
    $\begingroup$ $\csch$ doesn't work either, but $\coth$ does. It's not just Mathjax: those commands aren't in Latex either. $\endgroup$ Commented Jan 15, 2020 at 11:48
  • $\begingroup$ Thanks. First one works, but the second one ( *Declare..) does n't seem to. May be all hyperbolic functions and their inverses should be made readily available without user definition. $\endgroup$
    – Narasimham
    Commented Jan 15, 2020 at 16:20
  • 2
    $\begingroup$ This answer mentions various way to define things locally (in one post) - using \DeclarMathOperator, \newcommand, \def, \let. @user1729 The scope of a macro is now only a single post (or a single comment) and not the entire page - this was changed in January 2019, the change was announced in this answer. $\endgroup$ Commented Jan 15, 2020 at 16:51
  • $\begingroup$ \DeclareMathOperator should work, in the sense that it worked above for me... $\endgroup$
    – user1729
    Commented Jan 15, 2020 at 16:51
  • $\begingroup$ @Martin Thanks for the links. It's good that the scope was changed; it's silly otherwise (as the links demonstrate!). $\endgroup$
    – user1729
    Commented Jan 15, 2020 at 16:53
  • $\begingroup$ @1729 both work, may be was some error. $\endgroup$
    – Narasimham
    Commented Jan 15, 2020 at 17:16
  • $\begingroup$ For what it's worth, in a similar situation, I will normally type something like $...~\text{sech}(x)...$ and then, for each subsequent use, simply copy-paste. Sometimes, if the above approach looks really bad, I will instead go with $....~$ sech$(x)...$. Note that the ~ character, when enclosed in $...$, inserts a blank space. $\endgroup$ Commented Jun 10 at 19:52

1 Answer 1

5
$\begingroup$

To make my comments into an answer:

Firstly, you can define it manually, so \operatorname{sech}(x) renders as $\operatorname{sech}(x)$. A more fancy way is to put \DeclareMathOperator{\sech}{sech} somewhere in your post, and then \sech will work everywhere in the post.

For example, I'll declare the operator (invisibly) here: $\DeclareMathOperator{\sech}{sech}$

And it renders nicely here: $\sech(x)$

(Click on "edit", below, to see my code.)


There are other ways to do this. For example, you can use \newcommand rather than \DeclareMathOperator: \newcommand{\csch}{\operatorname{csch}} $\newcommand{\csch}{\operatorname{csch}}$ gives $\csch(x)$.

(One way not to do it is to use \mathrm{csch} rather than \operatorname{csch}. For example, \operatorname{csch}x $\operatorname{csch}x$ is correctly spaced while \mathrm{csch} $\mathrm{csch}x$ is not. See here for more details.)

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .