1 % Mathpartir --- Math Paragraph for Typesetting Inference Rules |
1 % Mathpartir --- Math Paragraph for Typesetting Inference Rules |
2 % |
2 % |
3 % Copyright (C) 2001, 2002, 2003, 2004, 2005 Didier Rémy |
3 % Copyright (C) 2001, 2002, 2003, 2004, 2005 Didier Rémy |
4 % |
4 % |
5 % Author : Didier Remy |
5 % Author : Didier Remy |
6 % Version : 1.2.0 |
6 % Version : 1.2.1 |
7 % Bug Reports : to author |
7 % Bug Reports : to author |
8 % Web Site : http://pauillac.inria.fr/~remy/latex/ |
8 % Web Site : http://pauillac.inria.fr/~remy/latex/ |
9 % |
9 % |
10 % Mathpartir is free software; you can redistribute it and/or modify |
10 % Mathpartir is free software; you can redistribute it and/or modify |
11 % it under the terms of the GNU General Public License as published by |
11 % it under the terms of the GNU General Public License as published by |
253 |
253 |
254 \let \mpr@fraction \mpr@@fraction |
254 \let \mpr@fraction \mpr@@fraction |
255 |
255 |
256 %% A generic solution to arrow |
256 %% A generic solution to arrow |
257 |
257 |
|
258 \def \mpr@@fractionaboveskip {0ex} |
|
259 \def \mpr@@fractionbelowskip {0.22ex} |
|
260 |
258 \def \mpr@make@fraction #1#2#3#4#5{\hbox {% |
261 \def \mpr@make@fraction #1#2#3#4#5{\hbox {% |
259 \def \mpr@tail{#1}% |
262 \def \mpr@tail{#1}% |
260 \def \mpr@body{#2}% |
263 \def \mpr@body{#2}% |
261 \def \mpr@head{#3}% |
264 \def \mpr@head{#3}% |
262 \setbox1=\hbox{$#4$}\setbox2=\hbox{$#5$}% |
265 \setbox1=\hbox{$#4$}\setbox2=\hbox{$#5$}% |
263 \setbox3=\hbox{$\mkern -3mu\mpr@body\mkern -3mu$}% |
266 \setbox3=\hbox{$\mkern -3mu\mpr@body\mkern -3mu$}% |
264 \setbox3=\hbox{$\mkern -3mu \mpr@body\mkern -3mu$}% |
267 \dimen0\ht3\advance\dimen0 by \dp3\relax |
265 \dimen0=\dp1\advance\dimen0 by \ht3\relax\dp1\dimen0\relax |
268 \dimen0 0.5\dimen0\relax |
266 \dimen0=\ht2\advance\dimen0 by \dp3\relax\ht2\dimen0\relax |
269 \advance \dimen0 by \mpr@@fractionaboveskip |
267 \setbox0=\hbox {$\box1 \@@atop \box2$}% |
270 \setbox1=\hbox {\raise \dimen0 \box1}\relax |
|
271 \dimen0 -\dimen0\advance \dimen0 \mpr@@fractionaboveskip\dimen0 -\dimen0 |
|
272 \advance \dimen0 by \mpr@@fractionbelowskip |
|
273 \setbox2=\hbox {\lower \dimen0 \box2}\relax |
|
274 \setbox0=\hbox {$\displaystyle {\box1 \atop \box2}$}% |
268 \dimen0=\wd0\box0 |
275 \dimen0=\wd0\box0 |
269 \box0 \hskip -\dimen0\relax |
276 \box0 \hskip -\dimen0\relax |
270 \hbox to \dimen0 {$% |
277 \hbox to \dimen0 {$%\color{blue} |
271 \mathrel{\mpr@tail}\joinrel |
278 \mathrel{\mpr@tail}\joinrel |
272 \xleaders\hbox{\copy3}\hfil\joinrel\mathrel{\mpr@head}% |
279 \xleaders\hbox{\copy3}\hfil\joinrel\mathrel{\mpr@head}% |
273 $}}} |
280 $}}} |
274 |
281 |
275 %% Old stuff should be removed in next version |
282 %% Old stuff should be removed in next version |
352 |
359 |
353 %% Keys that make sence in all kinds of rules |
360 %% Keys that make sence in all kinds of rules |
354 \def \mprset #1{\setkeys{mprset}{#1}} |
361 \def \mprset #1{\setkeys{mprset}{#1}} |
355 \define@key {mprset}{andskip}[]{\mpr@andskip=#1} |
362 \define@key {mprset}{andskip}[]{\mpr@andskip=#1} |
356 \define@key {mprset}{lineskip}[]{\lineskip=#1} |
363 \define@key {mprset}{lineskip}[]{\lineskip=#1} |
|
364 \define@key {mprset}{lessskip}[]{\lineskip=0.5\lineskip} |
357 \define@key {mprset}{flushleft}[]{\mpr@centerfalse} |
365 \define@key {mprset}{flushleft}[]{\mpr@centerfalse} |
358 \define@key {mprset}{center}[]{\mpr@centertrue} |
366 \define@key {mprset}{center}[]{\mpr@centertrue} |
359 \define@key {mprset}{rewrite}[]{\let \mpr@fraction \mpr@@rewrite} |
367 \define@key {mprset}{rewrite}[]{\let \mpr@fraction \mpr@@rewrite} |
360 \define@key {mprset}{atop}[]{\let \mpr@fraction \mpr@@nofraction} |
368 \define@key {mprset}{atop}[]{\let \mpr@fraction \mpr@@nofraction} |
361 \define@key {mprset}{myfraction}[]{\let \mpr@fraction #1} |
369 \define@key {mprset}{myfraction}[]{\let \mpr@fraction #1} |
362 \define@key {mprset}{fraction}[]{\def \mpr@fraction {\mpr@make@fraction #1}} |
370 \define@key {mprset}{fraction}[]{\def \mpr@fraction {\mpr@make@fraction #1}} |
363 \define@key {mprset}{sep}{\def\mpr@sep{#1}} |
371 \define@key {mprset}{sep}{\def\mpr@sep{#1}} |
|
372 \define@key {mprset}{fractionaboveskip}{\def\mpr@@fractionaboveskip{#1}} |
|
373 \define@key {mprset}{fractionbelowskip}{\def\mpr@@fractionbelowskip{#1}} |
364 |
374 |
365 \newbox \mpr@right |
375 \newbox \mpr@right |
366 \define@key {mpr}{flushleft}[]{\mpr@centerfalse} |
376 \define@key {mpr}{flushleft}[]{\mpr@centerfalse} |
367 \define@key {mpr}{center}[]{\mpr@centertrue} |
377 \define@key {mpr}{center}[]{\mpr@centertrue} |
368 \define@key {mpr}{rewrite}[]{\let \mpr@fraction \mpr@@rewrite} |
378 \define@key {mpr}{rewrite}[]{\let \mpr@fraction \mpr@@rewrite} |