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 have the following macro:

   \newcommand{\INFERRULE}[3][]{%
   \ensuremath{\inferrule{\mathstrut #2}{\mathstrut #3}\ifx\\#1\\\else\enskip(#1)\fi}}

I want to make it sensitive to \\ so that I can write commands such as:

   \[
   \INFERRULE[i \to j]{[i, i, j, k] \\ [i, k, j, j]}{[i, i, k, j]}
   \]

However, the way I defined the macro, it is ignoring the \\. Is there a way to fix it?

share|improve this question
    
I tried using a begin{array} environment instead, but it seems like the inferrule does not let me do that? –  kloop Mar 12 '11 at 16:05
5  
@kloop: can you please mention what package provides \inferrule: the answer will depend on what that command does? (or, even better, provide a full minimal working example, starting with \documentclass{...} and ending at \end{document}) –  Bruno Le Floch Mar 12 '11 at 16:05
    
I managed to fix that by using begin{array} inside and \cr instead of \\. (apparently \\ is \crcr which does not work but just one \cr works.) thank you all! –  kloop Mar 12 '11 at 16:58
1  
To answerers: I think \inferrule comes from the mathpartir package. @kloop: It might help if you explain what you want the output to look like, as well as what you want to write in source. –  Matthew Leingang Mar 12 '11 at 17:30
1  
@kloop: If your problem is fixed now, please post your solution as answer and accept it so that the question is marked as answered. Otherwise it will stay "unanswered" forever. Thank you. –  Martin Scharrer Mar 12 '11 at 19:13
show 2 more comments

1 Answer

I'm not sure if you're still interested in an answer, but assuming the following things about your question:

  • You are using the mathpartir package which provides the \inferrule macro

  • You would like to have multi-line premises

it seems easy to do. The mathpartir documentation says

A newline can be forced by adding an empty line \\\\

\inferrule {aa \\\\ bb} {dd \\ ee \\ ff}

Since your \INFERRULE is a just a wrap-around for \inferrule you can do the same thing. Here is a working example:

\documentclass{article}
\usepackage{mathpartir}
\newcommand{\INFERRULE}[3][]{%
\ensuremath{\inferrule{\mathstrut #2}{\mathstrut #3}\ifx\\#1\\\else\enskip(#1)\fi}}
\begin{document}
\[
   \INFERRULE[i \to j]
        {[i, i, j, k] \\ [i, k, j, j]}
        {[i, i, k, j]}
\]
\[
    \INFERRULE[i \to j]
        {[i, i, j, k] \\\\ [i, k, j, j]}
        {[i, i, k, j]}
\]    
\end{document}

sample code output

share|improve this answer
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.