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.

I'm currently working on a report where the majority of subscripts will be non-italic. The way I know how to do this currently is via \mathrm{}, which is an absolute horror when you have to do it many times per equation. Any ways around this? I do have the mtpro2 package, but not sure if there is an option I'm overlooking.

share|improve this question
5  
tex.stackexchange.com/questions/156641/…, is one way. you may get into problems with other packages etc. –  daleif Feb 6 at 9:53

4 Answers 4

up vote 6 down vote accepted

Are the subscript materials you have in mind the names of variables? If so, the variable names should probably be set in upright mode regardless of their position relative to the math baseline. However, other subscript material, such as the letters i and t that serve to index elements of sequences, should probably continue to be set in italics. Thus, an approach that typesets all subscript material in upright-roman mode isn't entirely desirable, right?

Fortunately, typesetting all variable names in upright-roman letters can be achieved easily by taking the following two-step approach:

  1. Set up a macro named (say) \V in the preamble to denote that its argument is a variable name:

    \usepacakge{amsmath} % loads 'amstext' package, which redefines \textup to be scalable
    \newcommand{\V}[1]{\textup{#1}}
    % Next, define various freqently-used variable names using the \V macro:
    \newcommand\Initial{\V{Initial}}
    \newcommand\Final{\V{Final}}
    
  2. In the body of the document, you might then write something like

    \begin{equation}
    F_{\Final} = 3F_{\Initial} + 2F_{\V{Intermediate}}
    \end{equation}
    

Note that this approach lets you inform LaTeX on the fly, with a minimum of fuss, that certain strings are variable names.

Another important virtue of this two-step approach is that if you change your mind later on and decide that variable names should be typeset differently -- e.g., in text-italics instead of text-upright roman -- all you'll need to do to accomplish this is to change the definition of the \V macro.

share|improve this answer
    
since when is \textup defined by amsmath, it comes from the kernel :-P –  daleif Feb 6 at 10:39
2  
@Mico: I would use package amsmath (or amstext) with \textup, because the package makes \textup scalable as \text is working. –  Heiko Oberdiek Feb 6 at 10:53
    
@HeikoOberdiek, interesting to know, BTW which part of amstext is responsible for that part (normal interest)? –  daleif Feb 6 at 11:01
2  
@daleif: The assignment \let\nfss@text\text makes all commands that uses \nfss@text scalable. –  Heiko Oberdiek Feb 6 at 11:24

Not an answer, but what I'd usually do is to have macros defined for the most common "complex" variables: e.g., \newcommand{\GammaD}{\Gamma_{\mathrm{D}}}.

share|improve this answer

A semi-answer from personal experience, that I'm sure some people will disagree with - and to my mind more useful than Joce's (who beat me too it while I was writing this):

Define macros for the common stuff, just stick with _\mathrm{...} for the rest. For example if you use $\lambda_\mathrm{pump}$ and $\lambda_\mathrm{probe}$ you could define:

\newcommand{\wavel}[1]{\lambda_{\mathrm{#1}}}

and try:

$\wavel{probe}=\wavel{2}$

to test - the numbers look fine. It looks like you can override this by doing $\wavel{\mathit{i}}$ if you really want - but you're better off not doing that.

Edit thanks to @tohecz: {} inserted around the subscript as \mathrm{#1} doesn't provide a group to the subscript without it as I thought it did, and my original is therefore not reliable.

share|improve this answer
1  
Now, if it was possible to tag answers, I would tag this one with do-not-do-this-please. It would be better to comply with the LaTeX's syntax at least a bit more, and use \lambda_{\mathrm{#1}} –  tohecz Feb 6 at 10:22
    
@tohecz you mean the extra {} around the \mathrm{#1}? I can add that in, but I'd like to understand why first - does the \mathrm{#1} not already [weak terminology alert] provide a group to the subscripting _? Or to put it another way: what's wrong with the syntax given that it works? –  Chris H Feb 6 at 10:47
    
No, it does not provide a group. It's actually a token and a group, so if you think of _ as of a macro with one argument, x_\mathrm{y} is invalid syntax. You're right that it works, which is bceause of how TeX performs the expansion of _. It works as long as nobody tweaks _ to behave in a different way; then it will likely stop working. –  tohecz Feb 6 at 10:50
    
@tohecz, thanks for the explanation, I've edited it in. looking at my main macro collection I'd usually done it right anyway, just a couple of recent definitions were wrong. –  Chris H Feb 6 at 11:08

What I usually have in my documents in the preamble is the following line

\providecommand{\cind}[1]{_{\textrm{#1}}}

With this command I'm completely flexible with the variable name as well as with the index name and I don't have to define something else in the preamble.

share|improve this answer

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.