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.:


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?

  • It's not strictly correct (in LaTeX syntax), but \bar\cellSolid will only put the bar on the Y, not the Y with subscript. – ChrisS Oct 9 '13 at 8:39
  • The bar is still shifted by a bit. – user1350992 Oct 9 '13 at 8:44
  • Does $\overline{\cellSolid}$ produce the desired result? – jub0bs Oct 9 '13 at 9:21
  • No, the \overline extends over the index as well. And even on its own, it's much wider than \bar, so it looks wrong. – user1350992 Oct 9 '13 at 9:23
  • 1
    I usually use \overline for closures, \bar being too short. If a set is called Y_0 I would want the line to go over the whole symbol pair, to distinguish from a "0 opertaion" on the closure. Thus I think Jubobs suggestion is the correct one. – Andrew Swann Oct 9 '13 at 9:27

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.

  • 1
    With amsmath, \operatorname{Adh} is easier than \mathop{\mathrm{Adh}} and \DeclareMathOperator{\Adh}{Adh} with \Adh in the text is even easier. – egreg Oct 9 '13 at 15:59

Here's my solution to the problem. It does the job to the letter, but \closure{poreSkeleton} is used instead of the more elegant \closure{\poreSkeleton}. If anyone knows of a package that provides a similar functionality, or possible problems with this approach, please let me know.

% ———begin setup———————————————————————————————————————————————————————————————————
  \expandafter\newcommandx\csname #1\endcsname[1][1=]{\ifstrequal{##1}{}
      {\errmessage{"#1" has no field named "##1"}}
\newcommand\set[3]{             % this, field, value
% ———end setup—————————————————————————————————————————————————————————————————————


  Plain:          & $\poreSkeleton$          $\Omega_0^\varepsilon$\\
  Messy closure:  & $\bar{\poreSkeleton}$    $\bar{\Omega_0^\varepsilon}$\\
  Proper closure: & $\closure{poreSkeleton}$ $\bar{\Omega}_0^\varepsilon$

  • You can define a toksloadcsident macro like this \def\toksloadcsident#1\to#2{\edef\toksload@a{\expandafter\ignore\string#1}#2=\expandafter{\toksload@a}} that loads token register #2 with the identifiant of the macro #1 (without the \`). To check if a token is a macro you can use \ifcat. You may look up for \toksloadcs` and \testcs in my TeX format Bhrìd Tex. svn.gna.org/viewcvs/bhrid/trunk/src/kernel.nw?view=markup – Michael Le Barbier Grünewald Oct 9 '13 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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