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.

Currently, using \max{1,2} will print:

max 1,2.

How do I alter it such that it prints:

max{1,2},

without having to use \max{\{1,2\}} in text?

Note: I'm fine with making a new function called \max2 that achieves this (if overwriting the original function is a problem for some reason).

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

\max does not take an argument so you don't need \max{\{1,2\}} just \max\{1,2\} . However if you want to save yourself those two backslashes

\let\oldmax\max
\def\max#1{\oldmax\{#1\}}
share|improve this answer
    
In LaTeX, \max is defined as a mathop item that can take subscript limits, viz., \def\max{\mathop{\operator@font max}}. With your setup, the command $\max_z{a,b}$ is legal but results in something rather awful-looking. It may be wise to leave \max alone and provide an entirely new command, e.g., \def\maxi#1{\textrm{max}\{#1\}}. –  Mico Oct 11 '12 at 15:44
add comment

Your Answer

 
discard

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