Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 12 down vote accepted

I would say

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

Perhaps too simplistic, but it should work.

share|improve this answer
    
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 0: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 7:14
    
@Konrad Yes, it has no check like the default \(...\). –  egreg Jul 20 '11 at 7:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.