[Tex/LaTex] How to write a math closure with subscript in LaTeX

math-mode

Currently I'm writing closures with a bar, e.g. \bar{\Omega}. Maybe there's a better way,
but it looks more or less OK.

The problems start when I want to define e.g.:

\newcommand{\cellFluid}{Y}
\newcommand{\cellSolid}{\cellFluid_0}

Now \bar{\cellSolid} looks very ugly, and I have to use \bar{\cellFluid}_0 which
defeats the point of defining \cellSolid and makes the code hard to read.

How can I solve this problem?

Best Answer

Your implicit expectation that it is possible to uniformly typeset the closure of any piece of formula results from mistaking TeX for a markup system while it is a typesetting system. Often enough, you can ignore the distinction between these two concepts, which is made especially blurry by LaTeX. But when it comes to typesetting maths, it is not possible to assume that both concepts are the same (see how MathML distinguishes presentation and semantics).

To solve your problem, add near the definition of \cellFluid a new definition for a macro \cellFluidBar typesetting the closure of \cellFluid.

Alternatively you can look for alternative notations for the closure, such as $\mathop{\mathrm{Adh}}_X Y_0$, that are cumbersome but smooth that edge between markup and typesetting.

If you enjoy programming TeX, you can devise a \closure macro taking a unique argument and typestting its closure in a generic way but supports a dictionary of exceptions. Aside from fun, there is probably very little benefits over the first, easy and straightforward, solution.

Related Question