8

I use the nath package to get automatically-sized delimiters, but it breaks having a \begin{array}{…}…\end{array} within a \frac{}{} (simply removing the \usepackage{nath} below fixes the example, but I need nath for other stuff).

\documentclass{article}
\usepackage{nath}
\begin{document}
\begin{equation}
  \begin{array}{c}a\\b\\c\end{array}% This works
  \frac{numerator}{denominator}% This works
  % I want to put the array at the numerator's place
  \frac{\begin{array}{c}a\\b\\c\end{array}}{denominator}% This fails
\end{equation}
\end{document}

I'm trying to do this to typeset some simple natural deduction proofs (one or several hypotheses followed by a horizontal line, then one or several conclusions), but packages like bussproofs.sty are clearly overkill (I don't need to typeset full proofs, just a single deduction rule). While \frac{}{} is semantically incorrect for this use, it is simple and gives the visual result I need.

Edit: The error message is ERROR: LaTeX Error: Environment ARRAY undefined.

8

For some reason, nath uses \uppercase when working on fractions (I've not checked the details, but the error message is about ARRAY being undefined).

This hack seems to work:

\documentclass{article}
\usepackage{nath}
\newenvironment{ARRAY}[2][c]{\lowercase{\array[#1]{#2}}}{\endarray}

\begin{document}
\begin{equation}
  \begin{array}{c}a\\b\\c\end{array}\quad
  \frac{numerator}{denominator}\quad
  \frac{\begin{array}{c}a\\b\\c\end{array}}{denominator}
\end{equation}
\end{document}

enter image description here


A less hackish way is to hide array:

\newcommand{\morelines}[1]{\begin{array}{c}#1\end{array}}

and

\begin{equation}
\frac{\morelines{a\\b\\c}}{denominator}
\end{equation}

or even

\newcommand{\morelines}[1]{\begin{array}{c}#1\end{array}}
\newcommand{\deduction}[2]{\frac{\morelines{#1}}{\morelines{#2}}}

and inputting your deduction as

\begin{equation}
\deduction{a\\b\\c}{denominator}
\end{equation}

I'm more convinced about not using nath.

  • @GeorgesDupéron I've added a less hackish method – egreg Jun 17 '12 at 15:21
  • A documentation with $$...$$ gives the result -- I am too old. – Marco Daniel Jun 17 '12 at 16:05
  • @MarcoDaniel : What do you mean ? I don't get it. Besides, thanks for the update egreg :) . – Georges Dupéron Jun 17 '12 at 18:56
  • @GeorgesDupéron: The documentation use $$...$$ for there examples. However this isn't correct. – Marco Daniel Jun 17 '12 at 19:38
  • @MarcoDaniel I don't know why $$ is used in the documentation. I'm more concerned about using nath in general: it takes too much for granted. For instance, a formula like the one on page 4 (A/B\otimes C/D) would rarely be written with full fractions in display mode, in my field. – egreg Jun 17 '12 at 19:44
2

For the particular example in the question, a \matrix could be used as well

\documentclass{article}
\usepackage{nath}
\begin{document}
\begin{equation}
  \frac{\matrix a\\ b\\ c\strut\endmatrix}{`denominator}
\end{equation}
\end{document}

enter image description here

2

After some more trial and error, I found that \hline works in the array environment.

\documentclass{article}
\usepackage{nath}
\begin{document}
\begin{equation}
  \begin{array}{c}
    Hypothesis_1\\
    Hypothesis_2\\
    \hline
    Conclusion_1
  \end{array}
\end{equation}
\end{document}

This gives the visual result I want, and doesn't have \frac{}{}'s semantic mismatch, however the arrays have a different vertical alignment, and tend to collide with what's left and right of them (they need a little more horizontal padding), so egreg's answer is better.

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.