I wish to center the 1 in the following LaTeX code:

    \displaystyle\frac{G_{max}(k){-}q_k'(CS)}{G_{max}(k){-}\Gmin(k)} & \text{if }G_{max}(k) {\neq} G_{min}(k) \\
    1                                                                &  \text{if }G_{max}(k) {=}G_{min}(k)

The image of the LaTeX is shown below:

enter image description here

  • 1
    Off-topic comment: Don't enclose the =, - and \neq symbols in curly braces, as doing so messes with TeX's spacing around binary (such as -) and relational operators (such as \leq and =). Conversely, do encase the "min" and "max" subscript strings in either \text{...} or \textup{...} so that they don't get interpreted as strings of variables (m, a, and x; m, i, and n). – Mico Sep 14 '13 at 9:18

Environment cases of package amsmath internally uses environment array with columns of type l. The column specification is @{}l@{\quad}l@{}. Thus \multicolumn will work:


Also an easier way is possible. The justification code of array/tabular just adds an \hfil at the right side of a column of type l. This moves the cell contents to the left. By adding \hfil to the left, the contents is centered. Adding \hfill would overrule the right \hfil and the contents would be moved to the right. Thus the code for centering is:

\hfil 1

The full example:

    \dfrac{G_{\text{max}}(k) - q_k'(CS)}
          {G_{\text{max}}(k) - G_{\text{min}}(k)}
    & \text{if }G_{\text{max}}(k) \neq G_{\text{min}}(k) \\
    % \multicolumn{1}{@{}c@{\quad}}{1} % variant with \multicolumn
    \hfil 1                    % variant with \hfil
    & \text{if }G_{\text{max}}(k) = G_{\text{min}}(k)



  • Various code errors of the incomplete MWE are corrected.
  • Text subscripts "min" and "max" are put in \text{...}.
  • The braces around binary operators and relational symbols are removed to correct the spacing around the symbols. (Adding braces makes these symbols to \mathord atoms without additional spacing.)
  • Package amsmath provides the shorthand \dfrac for \displaystyle\frac.

Brace of environment cases

The environment cases uses \left\lbrace\right. to set the left curly brace. I think, the reason that \lbrace is preferred over \{ in the code is optimization. \{ is defined as (latex.ltx):

  • Robustness is not needed, because macro \end is not robust because of \@checkend.
  • We are already in math mode, thus testing for the mode can be saved.

At the right side an empty delimiter is needed because \left and \right has to be used in properly nested pairs. But \right. will add the space \nulldelimiterspace. If environment is always the latest element of a line, then this space can be made available by redefining the end part of cases:

| improve this answer | |
  • If I'm just in time to ask this to someone with more^n experience than me: if the cases is defined by array, how the left delimiter is defined, in terms of code, inside amsmath?. I don't know if I could add this as a real question though...sorry for this. – TheVal Sep 14 '13 at 9:55
  • @AndreaL.: It's already in the answer, the full column specification for array is @{}l@{\quad}l@{}. That means two left aligned columns without spaces at the left and right of the array and \quad inbetween the columns. – Heiko Oberdiek Sep 14 '13 at 9:58
  • Got it, now I'll have to study more on the usage of amsmath package now that I'm preparing my first thesis (thanks) :-) – TheVal Sep 14 '13 at 10:00
  • @HeikoOberdiek - I think Andrea is asking which command generates the left-hand curly brace; for the record, it's \left\lbrace. – Mico Sep 14 '13 at 10:01
  • @Mico, I knew the definition, but I do not know how it is exactly implemented in the code of amsmath's cases to be different from \left\{\begin{array}... – TheVal Sep 14 '13 at 10:03

You can use the array environment as faked cases by delimiting it with \left\{ and \right., so that you can adjust the horizontal alignment with the letters cl as Centered and Left aligned.

Here is the MWE:

\addtolength{\arraycolsep}{-2.5pt}  % local modifications
 \begin{array}{cl}  % first column is centered
  \dfrac{G_{max}(k)-q_k'(CS)}{G_{max}(k)-G_{min}(k)} & \text{if }G_{max}(k)\neq G_{min}(k) \\
  1                                                  & \text{if }G_{max}(k)=G_{min}(k)

And here is the output:

enter image description here

By the way, you can enlarge the distance between the rows by simply adding more lenght to \arraystretch locally, or if you want to apply this rule generally you can define a new environment in the preamble of your document:

| improve this answer | |
  • To be honest, I copied the argument of the cases environment, now I'm editing one bit at time, and have to be fast at this, whew! :-) – TheVal Sep 14 '13 at 9:27
  • Don't worry...! – karlkoeller Sep 14 '13 at 9:28
  • @karlkoeller, now finished. It's always a pleasure to share knowledge (this time to someone with more rep than me ;-) – TheVal Sep 14 '13 at 9:41

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