2

I am using package mathpartir, with environment mathpar. In the environment I am using command \inferrule to write down some inference rules. The problem is that this rules are just too big, and I have way too many in my document so I'm struggling to fit them. I tried some ideas to try to lower the font size but it didn't work. I am also not sure if just trying to scale the graph is a good idea because I want the rules themselves to be smaller, so that they fit better in the figure.

Minimal example of what my code looks like:

\documentclass[11pt]{article}
\usepackage{mathpartir}
\begin{document}
\begin{figure}[h]
  \begin{mathpar}
    \inferrule*[left=Rule-X] { x = 1 }
      { x = 10 }
    \inferrule*[left=Rule-Y] { y = 1 }
      { y = 10 }
  \end{mathpar}
\end{figure}
\end{document}

Thank you!

6
  • 1
    As always on this site: please provide a full but minimal example. Then it is a lot easier to test your code.
    – daleif
    Oct 25, 2021 at 8:49
  • Thank you for the suggestion, done. Oct 25, 2021 at 9:07
  • Could you elaborate on why just reducing the font size does not work and what you would like to do? It is of course a bad idea, to reduce the font size too much as it will make your document hard to read, but \small is probably fine. If reducing the font size does not do the job, in what way do you imagine making this smaller? If possible, try to make a picture showing what you are looking for.
    – schtandard
    Nov 3, 2021 at 11:03
  • Where would you put the \small? I tried to do something like this I couldn't get it to scale down the font. Nov 3, 2021 at 11:09
  • 1
    Just writing \begin{mathpar}\tiny ... will giver smaller results. Section 3.6 of the documentation tells you to adjust the label style too. But is this what you want? Nov 4, 2021 at 11:10

2 Answers 2

1

You can set globally a style for the labels:

\documentclass[11pt]{article}
\usepackage{mathpartir}

\makeatletter
\define@key {mprset}{style}[1]{\def\TirNameStyle{#1}}
\makeatother

\mprset{style={\scriptsize\scshape}}

\begin{document}

\begin{mathpar}
  \inferrule*[left=Rule-X] { x = 1 }
    { x = 10 }
  \inferrule*[left=Rule-Y] { y = 1 }
    { y = 10 }
\end{mathpar}

\end{document}

enter image description here

You can use leftstyle or rightstyle for setting just the left labels or the right labels, respectively.

The code between \makeatletter and \makeatother is necessary because of a funny bug in the package. No change is needed for the leftstyle and rightstyle keys. In the original code we find

\define@key {mprset}{style}[1]{\def\TirNameStyle{#1}def}

which would typeset def when the key is set.

If your aim is to print the whole thing in reduced size:

\documentclass[11pt]{article}
\usepackage{mathpartir}

\makeatletter
\define@key {mprset}{style}[1]{\def\TirNameStyle{#1}}
\makeatother

\AtBeginEnvironment{mathpar}{\scriptsize}
\mprset{style={\scriptsize\scshape}}

\begin{document}

\begin{mathpar}
  \inferrule*[left=Rule-X] { x = 1 }
    { x = 10 }
  \inferrule*[left=Rule-Y] { y = 1 }
    { y = 10 }
\end{mathpar}

\end{document}

enter image description here

You can also selectively apply a size to the environment, but this requires using a different name.

\documentclass[11pt]{article}
\usepackage{mathpartir}

\makeatletter
\define@key {mprset}{style}[1]{\def\TirNameStyle{#1}}
\makeatother

\newenvironment{mymathpar}[1][]
 {%
  \AtBeginEnvironment{mathpar}{\scriptsize}%
  \mprset{style={#1\scshape}}%
  \mathpar
 }
 {\endmathpar}

\begin{document}

\begin{mymathpar}
  \inferrule*[left=Rule-X] { x = 1 }
    { x = 10 }
  \inferrule*[left=Rule-Y] { y = 1 }
    { y = 10 }
\end{mymathpar}

\begin{mymathpar}[\scriptsize]
  \inferrule*[left=Rule-X] { x = 1 }
    { x = 10 }
  \inferrule*[left=Rule-Y] { y = 1 }
    { y = 10 }
\end{mymathpar}

\end{document}

enter image description here

1

@andrew-swann, in the comments, pointed out that it is possible to just scale down the font by specifying the font size in envinroment mathpar, like this:

\documentclass[11pt]{article}
\usepackage{mathpartir}
\begin{document}
\begin{figure}[h]
  \begin{mathpar}\tiny
    \inferrule*[leftstyle={\tiny \sc},left=Rule-X] { x = 1 }
      { x = 10 }
    \inferrule*[leftstyle={\tiny \sc},left=Rule-Y] { y = 1 }
      { y = 10 }
  \end{mathpar}
\end{figure}
\end{document}

Notice that in the labels I'm also choosing the font size and the \sc font style. And it is important to define the style before defining the label as it will not work in the opposite order.

2
  • 2
    Shouldn't \tiny be added after \begin{mathpar}?
    – gernot
    Nov 4, 2021 at 16:55
  • Yes, my bad. I changed it. Nov 10, 2021 at 12:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .