Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!mcsun!ukc!cam-eng!pi From: pi@eng.cam.ac.uk (Pablo Iglesias) Newsgroups: comp.text.tex Subject: Re. Getting rid of minus signs Message-ID: <24936@rasp.eng.cam.ac.uk> Date: 27 Mar 91 23:41:57 GMT Sender: news@eng.cam.ac.uk Lines: 38 I wrote > I want to create a command in LaTeX which would do the following: > > \negate{A} would give me -A. > \negate{-A} would give me A. I want to thank the several people who answered my query. The following, due to David Carlisle was the first solution that I got, and it did exactly what I wanted. I include it in case anyone else wants to know. -Pablo -------------------------------------------------- % Document Type: LaTeX % Master File: xx.tex % \documentstyle{article} \makeatletter \def\neg@te{\@ifnextchar-{\@gobble}{-}} \def\negate#1{\neg@te#1} \makeatother \begin{document} $\negate{-7}$ $\negate{88}$ $\negate{99} + \negate{-99} = 0$ \end{document} -- Pablo Iglesias Phone : +44 223 332813 Department of Engineering Fax : +44 223 332662 Cambridge University email : pi@eng.cam.ac.uk Cambridge, CB2 1RD, UK