I'm trying to come up with some macro for round parentheses that looks nicely in both inline
and display
modes. The constraints are:
- The macro should behave like
\left(
\right)
in display mode - It should behave like ordinary
(
and)
in all other cases - It should play well with subscripts
Here is what I've tried:
\documentclass{scrbook}
\usepackage{amsmath}
% commands for round parentheses
\newcommand{\rParA}[1]{\mathchoice{\left(#1\right)}{(#1)}{(#1)}{(#1)}}
\newcommand{\rParB}[1]{\left(#1\right)}
\begin{document}
\begin{minipage}[H]{0.5\linewidth}
Here is some process $\rParA{A^N_{\lfloor t / N \rfloor}}_t$.
Here is another process $\rParB{B^N_{\lfloor t / N \rfloor}}_t$.
Here is what they look like in display mode:
\begin{align*}
\rParA{A^N_{\lfloor t / N \rfloor}}_t
\quad
\rParB{B^N_{\lfloor t / N \rfloor}}_t
\end{align*}
\end{minipage}
\end{document}
This code contains two macros. The first one works with \mathchoice
, the second one just inserts \left
and \right
everywhere.
Here is the outcome:
The version A
behaves as expected in inline
-mode (the parentheses stay as short as possible, this is what I want), however, it breaks in display
-mode (the subscript floats somewhere up in the sky, this is bad).
The version B
occupies way to much space in inline
-mode (the parentheses are too tall and influence line-spacing), but the subscript in display
-mode is on it's correct position (this is good).
How can I get a macro that behaves like A
in inline
-mode but like B
in display
mode?
Best Answer
I'm not sure you want to do this or, better, I discourage you to do this: automatically applying
\left
and\right
is always wrong.