-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfancyhdrboxes.tex
163 lines (135 loc) · 3.14 KB
/
fancyhdrboxes.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
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
159
160
161
162
163
\documentclass{article}
\usepackage{fancyhdr}
\usepackage{array}
\usepackage{xcolor}
\newcommand{\tb}{\textbackslash}
\newcommand{\fhbox}{\texttt{\tb fancyhdrbox}}
% Vertical bar to indicate measurements
\newcommand{\R}{\rule[-0.3\baselineskip]{0.1pt}{\baselineskip}\hspace{-0.1pt}}
\setlength\fboxsep{0pt}
\newcommand{\showbaseline}{%
\begin{picture}(0,0)
\put(-1cm,0){\color{red}\rule{7cm}{0.1pt}}
\end{picture}%
}
\begin{document}
This documents shows examples of \fhbox{} with different alignments. The red line shows the baseline for the alignment. Each example consists of two boxes with the same alignment and is preceded by the code for it (except the code for the baseline and the \texttt{\tb fbox} around it).
\subsection*{t-aligned boxes:}
\begin{verbatim}
\fancyhdrbox[t]{%
ABC\hspace{2.5cm} \\
xyz \\ XYZ \\
\Huge DEF ghij
}%
\fancyhdrbox[t]{%
\Huge ABC \\
DEF ghij
}
\end{verbatim}
\fbox{\showbaseline\fancyhdrbox[t]{%
ABC\hspace{2.5cm} \\
xyz \\ XYZ \\
\Huge DEF ghij
}%
\fancyhdrbox[t]{%
\Huge ABC \\
DEF ghij
}}
\subsection*{T-aligned boxes:}
\begin{verbatim}
\fancyhdrbox[T]{%
ABC \\
xyz \\ XYZ \\
\Huge DEF ghij
}%
\fancyhdrbox[T]{%
\Huge ABC \\
DEF ghij}
\end{verbatim}
\fbox{\showbaseline\fancyhdrbox[T]{%
ABC \\
xyz \\ XYZ \\
\Huge DEF ghij
}%
\fancyhdrbox[T]{%
\Huge ABC \\
DEF ghij}}
\newpage
\subsection*{b-aligned boxes:}
\begin{verbatim}
\fancyhdrbox[b]{%
ABC \\
xyz \\ XYZ \\
\Huge DEF ghij
}%
\fancyhdrbox[b]{%
\Huge ABC \\
DEF ghij}
\end{verbatim}
\fbox{\showbaseline\fancyhdrbox[b]{%
ABC \\
xyz \\ XYZ \\
\Huge DEF ghij
}%
\fancyhdrbox[b]{%
\Huge ABC \\
DEF ghij}}
\subsection*{B-aligned boxes:}
\begin{verbatim}
\fancyhdrbox[B]{%
ABC \\
xyz \\ XYZ \\
\Huge DEF ghij
}%
\fancyhdrbox[B]{%
\Huge ABC \\
DEF ghij}
\end{verbatim}
\fbox{\showbaseline\fancyhdrbox[B]{%
ABC \\
xyz \\ XYZ \\
\Huge DEF ghij
}%
\fancyhdrbox[B]{%
\Huge ABC \\
DEF ghij}}
\newpage
\subsection*{c-aligned boxes:}
The first box has an explicit \texttt{[c]} positioning, which implies both vertical and horizontal centering. The second one uses the default positioning (i.e. it is not explicitely specified), which make it \texttt{[cl]}, i.e horizontally left aligned.
\begin{verbatim}
\fancyhdrbox[c]{%
ABC \\
xyz \\ XYZ \\
\Huge DEF ghij %\rule{1pt}{\baselineskip}%
}%
\fancyhdrbox{%
\Huge ABC \\
DEF ghij}
\end{verbatim}
\fbox{\showbaseline\fancyhdrbox[c]{%
ABC \\
xyz \\ XYZ \\
\Huge DEF ghij %\rule{1pt}{\baselineskip}%
}%
\fancyhdrbox{%
\Huge ABC \\
DEF ghij}}
\subsection*{c-aligned with width:}
\begin{verbatim}
\fancyhdrbox[c][0.4\textwidth]{%
ABC \\ xyz \\ XYZ\texttt{\textbackslash\textbackslash[10pt]} \\[10pt]
{\Huge DEF ghij}%
}%
\fancyhdrbox[c][0.2\textwidth]{%
{\Huge ABC}\\
DEF ghij}
\end{verbatim}
\noindent\R\makebox[0.4\textwidth]{0.4\tb textwidth}\R\makebox[0.2\textwidth]{0.2\tb textwidth}\R\\[2pt]
\fbox{\showbaseline\fancyhdrbox[c][0.4\textwidth]{%
ABC \\ xyz \\ XYZ\texttt{\textbackslash\textbackslash[10pt]} \\[10pt]
{\Huge DEF ghij}%
}%
\fancyhdrbox[c][0.2\textwidth]{%
{\Huge ABC}\\
DEF ghij}}
\end{document}