0

I'm using the Ott tool and the ott-alt package for automatically generating and typesetting a large number of inference rules. Some sets are too large to fit on one page.

The ott-alt package puts them in a mathparpagebreakable environment, which is great for allowing them to spread across multiple pages, as well as for automatically adding line-breaks at appropriate points.

However, there's no captions. I can add a title to the start, but someone looking at the second page of rules has no context for which rules they're looking at.

I'm wondering, is there some kind of environment I can wrap this in that will do all or some of the following:

  • Wrap the mathpar in a box/border on each page it occurs
  • Add a caption to the bottom, or title to the top of each page's version, preferably marking the later pages as "continued"
  • Treat them like floats/figures, so they are placed nicely in the text, instead of disrupting the flow, and can be given nice labels and numbers.

The key is that it has to be automatic: the rules are machine generated, so its not feasible for me to go in and insert the page-breaks or split the figures myself.

I'm willing to get into "hack-ish" stuff: I have control over the format of the generated TeX code (to a degree), so if there's something I need to inject into each rule to make this possible, that's likely an option.

EDIT: Minimal working example:

\documentclass{article}
\usepackage{mathpartir}
\usepackage{semantic}
\usepackage{lipsum}

\newcommand{\myrule}{\inference{Premise\\Premise\\Premise\\Premise\\Premise\\Premise}{Conclusion}}
\newcommand{\myrulelong}{\inference{Premise\\Premise\\Premise\\Premise\\Premise\\Premise}{Conclusion!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}}


\begin{document}

\lipsum

\begin{mathparpagebreakable}
\textbf{My rule}\\

\myrule \and
\myrule \and
\myrule \and 
\myrule \and 
\myrulelong \and 
\myrulelong \and 
\myrulelong \and 
\myrulelong \and 
\myrulelong \and 
\myrulelong \and 
\end{mathparpagebreakable}

\lipsum

\end{document}
1

I think tcolorbox can solve all three requirements:

\documentclass{article}
\usepackage{mathpartir}
\usepackage{semantic}
\usepackage{duckuments}
\usepackage[]{tcolorbox}
\tcbuselibrary{breakable}

\newcommand{\myrule}{\inference{Premise\\Premise\\Premise\\Premise\\Premise\\Premise}{Conclusion}}
\newcommand{\myrulelong}{\inference{Premise\\Premise\\Premise\\Premise\\Premise\\Premise}{Conclusion!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}}

\newenvironment{mathparpagebreakableboxed}[2][]
  {%
    \begin{tcolorbox}[
        ,title={#2}
        ,breakable
        ,title after break={#2 (\textit{cont.})}
        ,#1
      ]%
      \begin{mathparpagebreakable}%
  }
  {%
      \end{mathparpagebreakable}%
    \end{tcolorbox}%
  }

\begin{document}

\blindduck[-]

\begin{mathparpagebreakableboxed}[% additional maybe interesting options
    ,vfill before first%
    %,float % if it should float
  ]{My rule}
\myrule \and
\myrule \and
\myrule \and 
\myrule \and 
\myrulelong \and 
\myrulelong \and 
\myrulelong \and 
\myrulelong \and 
\myrulelong \and 
\myrulelong \and 
\end{mathparpagebreakableboxed}

\blindduck[-]

\end{document}

You might change some of the default options in mathparpagebreakableboxed to your liking.

enter image description here enter image description here

  • @jmite note that tcolorbox doesn't give any referencable number with just float as an option, that would require some additional work (like setting up a counter, refstepping it on each floating box and putting it in the title. – Skillmon Mar 28 '18 at 20:21
  • Looks like the blend into option will help with that. I've tried enabling float, but for some reason that puts all the figures at the end of the document. I'll keep debugging, but that's definitely a separate issue. Thanks! – jmite Mar 28 '18 at 21:36
  • @jmite use \tcbset{floatplacement=htbp} in your preamble. – Skillmon Mar 28 '18 at 21:38

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.