summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/boxedminipage/boxedminipage.sty
blob: 90aab282f877d80cbf95b84e1ca2a4a6c2bde729 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%%
%% This is file `boxedminipage.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% boxedminipage.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2015-2020 by Scott Pakin <scott+bmp@pakin.org>
%% 
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3c of this license
%% or (at your option) any later version.  The latest version of this
%% license is in:
%% 
%%    http://www.latex-project.org/lppl/
%% 
%% and version 1.3c or later is part of all distributions of LaTeX version
%% 2008/05/04 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{boxedminipage}
    [2020/04/19 v1.1 Boxed LaTeX2e minipages]
\newsavebox{\bmp@box}
\newlength{\bmp@width}
\newlength{\bmp@height}
\def\bmp@relax{\relax}
\newcommand{\boxedminipage}[1][c]{%
  \@ifnextchar[{\bminipage@i[#1]}{\bminipage@i[#1][\relax]}%
}
\def\bminipage@i[#1][#2]{%
  \@ifnextchar[{\bminipage@ii[#1][#2]}{\bminipage@ii[#1][#2][s]}%
}
\def\bminipage@ii[#1][#2][#3]#4{%
  \setlength{\bmp@width}{#4}%
  \addtolength{\bmp@width}{-2\fboxrule}%
  \addtolength{\bmp@width}{-2\fboxsep}%
  \def\bmp@heighttext{#2}%
  \begin{lrbox}{\bmp@box}%
    \ifx\bmp@heighttext\bmp@relax
      \begin{minipage}[#1][#2][#3]{\the\bmp@width}%
    \else
      \setlength{\bmp@height}{\bmp@heighttext}%
      \addtolength{\bmp@height}{-2\fboxrule}%
      \addtolength{\bmp@height}{-2\fboxsep}%
      \begin{minipage}[#1][\bmp@height][#3]{\the\bmp@width}%
    \fi
}
\def\endboxedminipage{%
    \end{minipage}%
  \end{lrbox}%
  \fbox{\usebox{\bmp@box}}%
}
\endinput
%%
%% End of file `boxedminipage.sty'.