summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/minibox/minibox.tex
blob: 3cdfdf822475ebe2a802a091e061bd7e8ef9955b (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
\def\pkgname{minibox}

\RequirePackage{filecontents}
\begin{filecontents*}{README.txt}
___________________
The minibox package
v0.1

A small package to provide a convenient input syntax for
boxes that don't break their text over lines automatically,
but do allow manual lines breaks, and that shrink to
the natural width of the maximum line width.

    \minibox{Some\\ broken\\ text}
    \minibox[c]{Centred\\ broken\\ text}

Will Robertson
Copyright 2009
\end{filecontents*}


%%%%%%%%%1%%%%%%%%%2%%%%%%%%%3%%%%%%%%%4%%%%%%%%%5%%%%%%%%%6%%%%%%%%%7%%%%%%%%%
\begin{filecontents}{minibox.sty}
\ProvidesPackage{minibox}[2009/04/21 v0.1
  Another type of box.]

% This is the simplest definition I can get away with.
% But it's not perfect; expect changes in the future.
\newcommand\minibox[2][l]{%
  \begin{tabular}{@{}#1@{}}
    #2
  \end{tabular}%
}

\end{filecontents}
%%%%%%%%%1%%%%%%%%%2%%%%%%%%%3%%%%%%%%%4%%%%%%%%%5%%%%%%%%%6%%%%%%%%%7%%%%%%%%%




% Conditionally compile the documentation & generate the .ins file:
\providecommand\pstoolCompile{Y}
\if\pstoolCompile N
  \expandafter\endinput
\fi


\begin{filecontents*}{\pkgname.ins}
%&latex
\def\pstoolCompile{N}
\input minibox.tex
\csname@@end\endcsname
\end{filecontents*}




\makeatletter
\documentclass{article}

\usepackage[rm,medium]{titlesec}

\usepackage{bigfoot,xcolor}
\usepackage[colorlinks,linktocpage]{hyperref}
\usepackage{gmdoc}
\usepackage{gmverb}
\dekclubs
\stanzaskip=\bigskipamount 
\CodeSpacesGrey

\usepackage{tocloft,varwidth}
\setcounter{tocdepth}{1}
\def\tocwidthA{0.45}
\def\tocwidthB{0.45}
\def\cftpartfont{\scshape}
\def\cftsecfont{\small}
\cftbeforesecskip=0pt
\def\cftpartleader{}
\def\cftpartafterpnum{\cftparfillskip}
\def\cftsecleader{}
\def\cftsecafterpnum{\cftparfillskip}

\let\pkg\textsf
\def\pkgopt#1{\texttt{[#1]}}

\def\PDF{\textsc{pdf}}
\def\PS{\textsc{ps}}
\def\DVI{\textsc{dvi}}
\def\EPS{\textsc{eps}}

\usepackage{\pkgname}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{lmodern}
\usepackage[sc,osf]{mathpazo}
\linespread{1.1}
\frenchspacing

\GetFileInfo{\pkgname.sty}
\begin{document}

\title{The \pkg{\pkgname} package}
\author{Will Robertson\\\texttt{wspr81@gmail.com}}
\date{\fileversion\qquad\filedate}

\maketitle

\part{User documentation}

\section{The \cmd\minibox\ command}

It's sometimes useful to be able to stack text over lines
in a small box; this is similar to paragraph text broken over lines, but 
for small amounts of text when automatic line breaking is not required.
In other words, I'm looking for an \cmd\mbox\ that allows manual line breaks.
\begin{center}
\fbox{\vbox{\hbox{abcd}\hbox{efg}\hbox{h}}}
\end{center}
This sort of thing is a little awkward in plain \TeX\ and \LaTeX.
\begin{center}
|\vbox{\hbox{abcd}\hbox{efg}\hbox{h}}|\par
\end{center}
This package defines the \cmd\minibox\DescribeMacro{\minibox}\ command
to write this more conveniently. Here's an example:
\begin{center}
\verb|\def\x{abcd\\efg\\h}|
\def\x{abcd\\efg\\h}
\begin{tabular}{ccc}
\verb"\minibox{\x}" &
\verb"\minibox[c]{\x}" &
\verb"\minibox[r]{\x}" \\
\fbox{\minibox{\x}} &
\fbox{\minibox[c]{\x}} &
\fbox{\minibox[r]{\x}}
\end{tabular}
\end{center}

Note that all examples here have been framed with the \cmd\fbox\ command
to show the extent of the box; the output of \cmd\minibox\ itself does not have this border!
Actually, if you look (not too) closely, the \cmd\minibox\ output has a little more padding
than the |\vbox{\hbox{...}}| version; this will be rectified in a future release
of the package.

If you look at the source you'll see that the way \cmd\minibox\ command is 
implemented lends itself to begin mis-used to input generic tabular material;
this is not the intention of the command, however, and any such usage may
break in future versions of this package.

\section{Licence}

This package is freely modifiable and distributable under the terms and conditions of the \LaTeX\ Project Public Licence, version 1.3c or greater (your choice). The latest version of
this license is available at: \url{http://www.latex-project.org/lppl.txt}. This work is maintained by \textsc{Will Robertson}.

\clearpage
\part{Implementation}
\parindent=0pt
\DocInput{\pkgname.sty}
\end{document}