6

Joseph Wright mentions in an comment to this tex.SE answer that it is possible to “hook into” the \( and \) commands to change their behaviour. Say that I'd like to force a cramped style on all inline equations by e.g. wrapping them in \cramped (from the mathtools package) by hooking into the \( and \) commands. How would I do that? Or is there perhaps an easier way to force a cramped style?

You
  • 6,713
  • 2
  • 29
  • 27

1 Answers1

12

I would say

\def\(#1\){$\cramped{#1}$}

Perhaps too simplistic, but it should work.

egreg
  • 1,121,712
  • That seems to do the trick! – You Jul 19 '11 at 19:26
  • Nifty! Is there somebody who's willing to explain how the same result might be obtained with some of the commands provided by the etoolbox package? The package's documentation lists plenty of definitions of commands but, disappointingly, doesn't provide a single example. :-( – Mico Jul 20 '11 at 00:21
  • This will break down with nested math mode, won’t it? (IIRC \def scans its definition tokens greedily without parsing) – Konrad Rudolph Jul 20 '11 at 07:14
  • @Konrad Yes, it has no check like the default \(...\). – egreg Jul 20 '11 at 07:38