0

With pdflatex I often used \left( and \right) to scale the parenthesis of a function as in

\[\exp\left(\frac{a}{b}\right) \]

exp(a/b)

But this method was not perfect, because

Is there a modern solution in LuaLaTeX for this? Is there a reason why we do not write

\exp[bigg]{ \frac{a}{b} }

and define a good function with parenthesis? This could be done for example with DeclarePairedDelimiter from mathtools.

5
  • 1
    I have thought about it many times, how to improve the TeX math syntax, but have come to the conclusion that the syntax defined by Knuth is the optimal one. There are basically no improvements possible, which is probably why everyone else uses TeX math syntax (MathJax, recent MS Office, ...). Apr 25, 2019 at 9:50
  • 2
    (I deleted my comment, seeing that you amended the question.) The problem with your suggestion, I think, is that it forces all usages of \exp to use round parentheses. In the real world, that seems to be too restrictive. There is nothing stopping you from creating your own command for the exponential and other functions, though. Apr 25, 2019 at 10:03
  • @HenriMenke At first, I read your comment as being in opposition to such constructs as \DeclarePairedDelimiter, but on second reading, I think you are talking about the basic syntax for math, not whatever constructs people might build on top of it for their own use. Am I correct? Apr 25, 2019 at 10:05
  • @HaraldHanche-Olsen Sort of. I usually declare \abs for \lvert...\rvert in my documents, but the answer with \mexp I already find too much. I doubt that it will add a lot in terms of efficiency in the long run. Apr 25, 2019 at 10:36
  • 1
    @HenriMenke Indeed. I often use \DeclarePairedDelimiter\parens() and similar for other delimiters, though, not because it saves typing (it doesn't), but because it is easier to adjust the sizing of the parentheses in one place rather than two. And for curly braces it is useful because my editor will not match \{ and \} the way it does ordinary delimiters. Apr 25, 2019 at 12:11

1 Answer 1

3

You should not be afraid of mathtools. Note that I explicitly give it a different name, so we can use \exp internally.

But I agree with Henri and Haralds comments.

\documentclass[a4paper]{memoir}

\usepackage{mathtools}
\DeclarePairedDelimiterXPP\mexp[1]{\exp}{(}{)}{}{#1}
\begin{document}

\[
  \mexp*{\frac{a}{b}}
\]

\end{document}

A lot of the macros I use are specifically made to hide certain typographical aspects of math typesetting, such that they do not disturb the code.

For example

\[
   f(x) > 0 \qquad\text{for all $x>0$}
\]

vs

\[
 f(x) >0 \For{for all $x>0$}
\]

Here \qquad\text, to me, is typographical noise.

3
  • what does the * mean in this context? Apr 25, 2019 at 10:07
  • 1
    That means use \left\right. The alternatives are [\big] and its brethren, or nothing to get plain normal size delimiters. Apr 25, 2019 at 10:08
  • See the mathtools manual. Plus it changes the spacing on the left/right construction.
    – daleif
    Apr 25, 2019 at 10:08

You must log in to answer this question.

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