-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarkbox.tex
117 lines (97 loc) · 3.02 KB
/
markbox.tex
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
\documentclass{article}
% Copyright (C) 2001-2022 by Martin Scharrer <martin.scharrer@web.de>, Nov 12th 2011
% This is free code under the LPPL v1.3 or later version OR the CC BY-SA 3.0
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{collectbox}
\makeatletter
\newcommand\markbox{%
\collectboxcheckenv{markbox}%
\collectbox\@markbox
}
\def\@markbox{%
\begingroup
\sffamily\tiny
\begin{tikzpicture}[>=latex,semitransparent]
% Save example text in box
\def\HEIGHT{\the\ht\collectedbox}
\def\TOTALHEIGHT{\the\totalheight}
\def\WIDTH{\the\wd\collectedbox}
\def\DEPTH{\the\dp\collectedbox}
% Text node:
\node [inner sep=0pt,anchor=base west,opacity=1] {\usebox\collectedbox};
\useasboundingbox;
% Baseline
\draw (0,0) -- (\WIDTH,0);
% Box
\draw (0,-\DEPTH) rectangle (\WIDTH,\HEIGHT);
% Origin
\fill (0,0) circle (.25ex);
% Dimensions
\path (-.5ex,0) -- +(0,-\DEPTH) node [midway,left] {\DEPTH};
\path (-.5ex,0) -- +(0, \HEIGHT) node [midway,left] {\HEIGHT};
\path (\WIDTH,-\DEPTH) ++(.5ex,0) -- +(0,\TOTALHEIGHT) node [midway,right] {\TOTALHEIGHT};
\path (0,-\DEPTH) ++(0,-.5ex) -- +(\WIDTH,0) node [midway,below] {\WIDTH};
\end{tikzpicture}%
\endgroup
}
\makeatletter
\begin{document}
\markbox{Xy}
\vspace{1cm}
\begin{markbox}
\tabular{ccc}
A & B & CC \\
A & B & CC \\
A & B & CC \\
\endtabular
\end{markbox}
\vspace{1cm}
\begin{markbox}
\rotatebox[origin=b]{50}{%
\begin{markbox}
\tabular{ccc}
A & B & CC \\
A & B & CC \\
A & B & CC \\
\endtabular
\end{markbox}%
}%
\end{markbox}
\vspace{1cm}
\begin{markbox}
\begin{minipage}{5cm}
text text text text text text text text text text
text text text text text text text text text text
text text text text text text text text text text
text text text text text text text text text text
text text text text text text text text text texty
\end{minipage}%
\end{markbox}
\vspace{1cm}
\begin{markbox}
\begin{minipage}[b]{5cm}
text text text text text text text text text text
text text text text text text text text text text
text text text text text text text text text text
text text text text text text text text text text
text text text text text text text text text texty
\end{minipage}%
\end{markbox}
\vspace{1cm}
\begin{markbox}
\begin{minipage}[t]{5cm}
text text text text text text text text text text
text text text text text text text text text text
text text text text text text text text text text
text text text text text text text text text text
text text text text text text text text text texty
\end{minipage}%
\end{markbox}
\vspace{1cm}
\markbox{\includegraphics[width=5cm]{tiger}}
\vspace{1cm}
\markbox{\includegraphics[width=5cm,angle=180]{tiger}}
\vspace{1cm}
\markbox{\includegraphics[width=5cm,angle=100]{tiger}}
\end{document}