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 would like to write in LaTeX two equations:

equation1

and

enter image description here

I do not know how to do that...Particularly, how to write stuff underneath the max function. And also how to have this line over Wi or Wj.

PS: I do not ask for the whole equations, I am asking for the part that I do not know how to write in LaTeX :))

share|improve this question
add comment

2 Answers 2

up vote 8 down vote accepted

In the case of \max, the text below automatically. For other operators (like \int) or for inline formulas, you can use \limits. Longer text has to be in curly brackets:

\max\limits_{n_j \in succ(n_i)}

To get a line over your text, you can use \overline:

\overline{w_i}

Your formulas would be:

rank_u(n_i) = \overline{w_i} + \max\limits_{n_j \in succ(n_i)} (\overline{c_{ij}} + rank_u(n_j))
rank_d(n_i) = \max\limits_{n_j \in pred(n_i)} \{rank_d(n_j) + \overline{w_j} + \overline{c_{i,j}}\}

If you want to typeset rank and succ as an operator like max, you can either use \text{rank} from amsmath, or declare rank as a math operator (in your preamble):

\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\successor}{succ}

Please note that I chose \successor over \succ, as this is already used for a math symbol.

share|improve this answer
    
If the material material is typeset in displaymath mode, it is not necessary to use the \limits directive to inform LaTeX that the argument of the \max command should be typeset below the string "max". –  Mico Feb 12 at 11:01
    
You're right, in the case of \max in displaymath it is not necessary. I've thought of other operators like \intwhere one would need \limits. I've corrected this. –  Marcus Bitzl Feb 12 at 11:13
    
Thanks for this solution: I chose this one for my document :) –  MrJay42 Feb 12 at 12:43
    
@Mrjay42 You're welcome :-) –  Marcus Bitzl Feb 12 at 13:29
add comment

To have LaTeX place some material below below the string "max", simply use the macro \max_{...}: If you're in displaymath mode (which you will be if you're in an environment such as equation), this will result in the argument of the \max command being placed below (rather than in a subscript position) the string "max".

Separately, I would recommend that you typeset the strings "rank", "pred", and "succ" in upright-roman characters since they denote math "operators". One way to do this is to load the amsmath package and use its \DeclareMathOperator instruction to define the corresponding macros \rank, \pred, and \succ. Aside: Because the macro \succ already exists -- and creates a math symbol that looks like a curvy > sign -- it has to be undefined first before it can be redefined as a math operator. Obviously, if you need to use the original meaning of \succ elsewhere in your document, you should not redefine it to act as a math operator; instead, devise a new macro name, e.g., \succeeds.

Furthermore, I would use the \bar instruction to create lines above the "c" and "w" characters. Doing so creates horizontal lines that aren't quite as "heavy" as those produced by \overline.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for \DeclareOperator macro and align environment
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\pred}{pred}
\let\succ\relax % undefine \succ first
\DeclareMathOperator{\succ}{succ} % now redefine it as an "operator"
\begin{document}
\begin{align*}
\rank_u(n_i)&=\bar{w}_i + \max_{n_j\in\succ(n_i)}
  \bigl(\bar{c}_{i,j}+\rank_u(n_j)\bigr)\\
\rank_d(n_i)&=\bar{w}_i + \max_{n_j\in\pred(n_i)}
  \bigl\{ \rank_d(n_j)+\bar{w}_j+\bar{c}_{j,i}\bigr\}
\end{align*}
\end{document}
share|improve this answer
4  
Might be an idea to note that users should be very careful about redefining macros and only do so when they are exactly sure they know what the original macros does and that it is OK to change it. \span is the obvious example of what not to change. –  daleif Feb 12 at 11:27
    
@daleif - Excellent point! :-) I'll add an explicit note about this to my answer. –  Mico Feb 12 at 11:56
add comment

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.