OpenCores
URL https://opencores.org/ocsvn/phr/phr/trunk

Subversion Repositories phr

[/] [phr/] [trunk/] [doc/] [eventos/] [PHRposter SASE14/] [latex/] [baposter.cls] - Blame information for rev 363

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 363 maximiq
%%
2
%% This is file `baposter.cls'
3
%%
4
%% A relatively comfortable latex class to produce posters with a grid based
5
%% layout. It comes with a number of combinable styles and is (maybe only for
6
%% the writer) easy to extend, as all the graphics is based on pgf.
7
%%
8
%% It is meant to be used with pdftex, but might also work with pslatex if you
9
%% are not interested in things like transparency.
10
%%
11
%% Copyright (C) 2007-2011 Brian Amberg
12
%% Copyright (C) 2011      Reinhold Kainhofer 
13
%%
14
%% 29. September 2011:
15
%%     - Finally fixed confusion with paper size handling and landscape. This required seperate handling of papersizes
16
%%       known to the geometry package and other packages.
17
%% 26. September 2011:
18
%%     - Reverted drawing of faded borders to manual method, as the current result does not work with evince,
19
%%       and produced spurious colored boxes with okular and acroread.
20
%%     - Added one more example due to popular request
21
%% 16. September 2011:
22
%%     - Removed nag package, such that it compiles on older systems
23
%%     - Added more examples
24
%% 15. September 2011:
25
%%     - Merged fork by (rk) back into mainline, essentially taking over all the great improvements that Reinhold Kainhofer coded.
26
%%       We call this version 2, as it breaks the interface in some small points. Essentially watch out for this:
27
%%       - no/yes keys are now false/true
28
%%       - the shade-lr etc. keys have the hypen removed, and are now called shadelr etc.
29
%      - Added more examples, which are all adapted to work with the current version
30
%% 27. August 2011 (rk):
31
%%     - Completely factored out all drawing commands to handler functions, assigned via choice keys
32
%%     - Added cornerradius, boxheaderheight, boxpadding options
33
%%     - Added missing roundedright
34
%% 26. August 2011 (rk):
35
%%     - Turned headerbox cmd into posterbox environment (allows verbatim)
36
%%     - pass several options to packages
37
%%     - added debug cls option to reduce default output
38
%%     - rewrote several loops and ifthenelse
39
%%     - Use boolean and choice keys for all options
40
%%     - Changed all choice options to set a global function to
41
%%       \baposter@OPTION@OPTIONVALUE, which are a functions that execute the
42
%%       option's setting (drawing routine, color setting for tikz, etc.)
43
%%     - Add a5paper
44
%% 07. April 2011: Fixed paper size handling
45
%%     - Fixed Paper Size handling, you can now specify all page sizes using paperwidth=, paperheight= class options.
46
%%     - Added rudimentary documentation of the available keys.
47
%% 11. December 2010: Fixed "Empty Second Page" bug
48
%%     - A second empty page was introduced when a document ended with
49
%%           \end{poster}
50
%%         \end{document}
51
%%       This was fixed thanks to a suggestion by Martin Aulbach
52
%%     - Added
53
%%         \thispagestyle{empty}
54
%%       to suppress page numbers, which became visible when the margins are large.
55
%%       The underlying problem of page-size handling has not yet been solved.
56
%% 30. September 2010: Border Bugfixes
57
%%     - Correct background color with textborder=rounded-small, Thanks to Ke Chen for the bugreport and patch
58
%%     - Correctly draw rectangular text boxes, Thanks to abenkst for the bugreport and fix
59
%% 10. June 2010: Added option to set the number of columns
60
%%     - added a class option to set the number of columns
61
%%         - columns=5: sets the number of columns to 5, possible values are 1..6, default is 3 in portrait and 4 in landscape format
62
%% 29. April 2009: Incorporated Patches by Arne Henningsen
63
%%     - added some class options
64
%%        - a4shrink: shrink the paper to A4 size (for printing drafts or handouts)
65
%%        - movebody=Xpt: move the text/poster body Xpt to the right
66
%%                    (or to the left if Xpt is negative),
67
%%                    e.g. for manually centering the poster on the page
68
%%        - showframe: use the "showframe" option of the "geometry" package
69
%%        - a0paper (default): set paper size to A0
70
%%        - archE: set paper size to Arch E
71
%%     - setting "background" can be "none" now (otherwise the "showframe"
72
%%          option has no effect)
73
%%     - the page number has been removed (it was mostly not visible before)
74
%%     - the "margin=" option works now
75
%% 04. December 2008
76
%%     - Mainly an update to the landscape example
77
%% 14. November 2008
78
%%     - Actually center the title when eyecatcher is used.
79
%% 04. November 2008
80
%%     - Fixed bug with eyecatcher not working.
81
%% 26. June 2008
82
%%     - Fixed bug with plain background mode.
83
%% 14. June 2008
84
%%     - Support for portrait/landscape switching.
85
%%     - Some smaller bugfixes.
86
%% 01. June 2007
87
%%     - First version released.
88
%%
89
%% Use this class with pdflatex
90
%%
91
%% I have confirmed that this package works with
92
%%   - texlive 2007 and
93
%%   - miktex 2.7
94
%%
95
%% It does not seem to work with
96
%%   - miktex 2.2
97
%%   - some old versions of tetex
98
%%
99
%%
100
%% TODO:
101
%% -) Rename backgrounds back to shaded-tb shade-lr
102
%% -) Rename textborder back to rounded-small (consistent naming needed!)
103
%% -) Rename headershade back to shade-lr, shade-tb, shade-tb-inverse
104
%% -) Rename headershape back to small-rounded
105
%% -) Option value consistency (small-rounded vs. rounded-small; missing ones)
106
%% -) Rename \baposterHeaderSetShade, \baposterHeaderDrawText to include @ and verb
107
%%
108
%%
109
%% Licence: GPL
110
\ProvidesClass{baposter}[2011/11/26 v2.0 baposter class]
111
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
112
\LoadClass{article}
113
\typeout{baposter: Brian Amberg, 2007, 2008, 2009, 2010, 2011 | http://www.brian-amberg.de/uni/poster/}
114
\typeout{baposter: Reinhold Kainhofer, 2011 | http://reinhold.kainhofer.com/}
115
 
116
%% Define lengths only once on inclusion, such that we can make multiple posters
117
\newlength{\baposter@basepaperwidth}
118
\newlength{\baposter@basepaperheight}
119
\newlength{\baposter@basemargin}
120
\newlength{\baposter@finalpaperwidth}
121
\newlength{\baposter@finalpaperheight}
122
\newlength{\baposter@finalmargin}
123
\newlength{\headerheight}%
124
\newlength{\colwidth}%
125
\newlength{\colheight}%
126
\newlength{\baposter@@colspacing}%
127
\newlength{\baposter@box@@cornerradius}%
128
\newlength{\baposter@box@@boxheaderheight}%
129
\newlength{\baposter@box@@boxpadding}%
130
\newlength{\boxstartx}%
131
\newlength{\boxstarty}%
132
\newlength{\boxwidth}%
133
\newlength{\boxheight}%
134
\newlength{\baposter@titleimage@left@width}%
135
\newlength{\baposter@titleimage@right@width}%
136
\newlength{\baposter@titleimage@textwidth}%
137
\newbox\baposter@box@content%
138
\newbox\baposter@titleimage@left%
139
\newbox\baposter@titleimage@title%
140
\newbox\baposter@titleimage@right%
141
 
142
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
143
% Packages
144
%-------------------------------------------------------------------------------
145
% The only ``weird'' dependency of this package is pgf. All the rest should be
146
% installed on any decent system.
147
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
148
\typeout{Use Packages}
149
\RequirePackage{xkeyval}
150
\RequirePackage{calc}
151
\RequirePackage[cmyk]{xcolor}
152
\RequirePackage{tikz}
153
\RequirePackage{pgf}
154
\RequirePackage{ifthen}
155
\RequirePackage[T1]{fontenc}
156
%\RequirePackage[l2tabu, orthodox]{nag}
157
\usetikzlibrary{decorations}
158
\usetikzlibrary{fadings}
159
\usetikzlibrary{snakes}
160
\usetikzlibrary{calc}
161
 
162
 
163
 
164
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
165
% Settings
166
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
167
 
168
% Choose a smaller value for larger fonts
169
\newcommand{\baposter@fontscale}{0.292}
170
 
171
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
172
% Zoom
173
%-------------------------------------------------------------------------------
174
% We scale the page from fontscale * papersize up to papersize
175
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
176
 
177
 
178
%% Paper sizes
179
\newif\if@landscape
180
\newif\if@geometryKnowsThisSize
181
\DeclareOptionX{landscape}{\@landscapetrue}
182
\DeclareOptionX{portrait}{}
183
 
184
\newcommand{\baposter@setfinalpapersize}[2]{%
185
\if@geometryKnowsThisSize
186
  \setlength{\baposter@finalpaperwidth}{#1}%
187
  \setlength{\baposter@finalpaperheight}{#2}%
188
\else
189
\if@landscape
190
% Transpose length, if geometry does not handle the papersize based on the key
191
  \setlength{\baposter@finalpaperwidth}{#2}%
192
  \setlength{\baposter@finalpaperheight}{#1}%
193
\else
194
  \setlength{\baposter@finalpaperwidth}{#1}%
195
  \setlength{\baposter@finalpaperheight}{#2}%
196
\fi
197
\fi
198
}
199
 
200
% Default paperwidth and paperheight = a0paper
201
\DeclareOptionX{paperwidth}[841mm]{\setlength{\baposter@finalpaperwidth}{#1}}
202
\DeclareOptionX{paperheight}[1189mm]{\setlength{\baposter@finalpaperheight}{#1}}
203
\DeclareOptionX{archA}         {                           \baposter@setfinalpapersize{9in}{12in}}%
204
\DeclareOptionX{archB}         {                           \baposter@setfinalpapersize{12in}{18in}}%
205
\DeclareOptionX{archC}         {                           \baposter@setfinalpapersize{18in}{24in}}%
206
\DeclareOptionX{archD}         {                           \baposter@setfinalpapersize{24in}{36in}}%
207
\DeclareOptionX{archE}         {                           \baposter@setfinalpapersize{36in}{48in}}%
208
\DeclareOptionX{archE1}        {                           \baposter@setfinalpapersize{30in}{42in}}%
209
\DeclareOptionX{archE2}        {                           \baposter@setfinalpapersize{26in}{38in}}%
210
\DeclareOptionX{archE3}        {                           \baposter@setfinalpapersize{27in}{39in}}%
211
\DeclareOptionX{a0paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{841mm}{1189mm}}%g
212
\DeclareOptionX{a1paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{594mm}{841mm}}%g
213
\DeclareOptionX{a2paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{420mm}{594mm}}%g
214
\DeclareOptionX{a3paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{297mm}{420mm}}%g
215
\DeclareOptionX{a4paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{210mm}{297mm}}%g
216
\DeclareOptionX{a5paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{148mm}{210mm}}%g
217
\DeclareOptionX{a6paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{105mm}{148mm}}%g
218
\DeclareOptionX{b0paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{1000mm}{1414mm}}%g
219
\DeclareOptionX{b1paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{707mm}{1000mm}}%g
220
\DeclareOptionX{b2paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{500mm}{707mm}}%g
221
\DeclareOptionX{b3paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{353mm}{500mm}}%g
222
\DeclareOptionX{b4paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{250mm}{353mm}}%g
223
\DeclareOptionX{b5paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{176mm}{250mm}}%g
224
\DeclareOptionX{b6paper}       {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{125mm}{176mm}}%g
225
\DeclareOptionX{ansiapaper}    {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{8.5in}{11in}}%
226
\DeclareOptionX{ansibpaper}    {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{11in}{17in}}%
227
\DeclareOptionX{ansicpaper}    {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{17in}{22in}}%
228
\DeclareOptionX{ansidpaper}    {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{22in}{34in}}%
229
\DeclareOptionX{ansiepaper}    {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{34in}{44in}}%
230
\DeclareOptionX{letterpaper}   {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{8.5in}{11in}}%
231
\DeclareOptionX{legalpaper}    {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{8.5in}{14in}}%
232
\DeclareOptionX{executivepaper}{\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{7.25in}{10.5in}}%
233
\DeclareOptionX{screen}        {\@geometryKnowsThisSizetrue\baposter@setfinalpapersize{225mm}{180mm}}%g
234
 
235
% Margin
236
\setlength{\baposter@finalmargin}{1.5cm}
237
\DeclareOptionX{fontscale}[0.292]{\renewcommand{\baposter@fontscale}{#1}}
238
\DeclareOptionX{margin}   [1.5cm]{\setlength{\baposter@finalmargin}{#1}}
239
 
240
% move text/poster body to the right (or to the left if negative)
241
\newlength{\baposter@movebody}
242
\setlength{\baposter@movebody}{0cm}
243
\DeclareOptionX{movebody}[0cm]{\setlength{\baposter@movebody}{#1}}
244
 
245
 
246
\newif\if@debug
247
\DeclareOptionX{debug}{\@debugtrue}
248
%% Will be passed on to other packages (xcolor and geometry), still we don't want unused warnings
249
\DeclareOptionX{table}{}
250
\DeclareOptionX{showframe}{}
251
 
252
\ProcessOptionsX
253
 
254
\if@debug
255
\newcommand{\debug}[1]{\typeout{#1}}
256
\else
257
\newcommand{\debug}[1]{}
258
\fi
259
 
260
 
261
 
262
\setlength{\baposter@basepaperwidth} {\baposter@fontscale\baposter@finalpaperwidth }
263
\setlength{\baposter@basepaperheight}{\baposter@fontscale\baposter@finalpaperheight}
264
\setlength{\baposter@basemargin}     {\baposter@fontscale\baposter@finalmargin}
265
\newlength{\baposter@basemarginright}
266
\setlength{\baposter@basemarginright}{\baposter@basemargin}
267
\addtolength{\baposter@basemarginright}{-\baposter@fontscale\baposter@movebody}
268
\newlength{\baposter@basemarginleft}
269
\setlength{\baposter@basemarginleft}{\baposter@basemargin}
270
\addtolength{\baposter@basemarginleft}{\baposter@fontscale\baposter@movebody}
271
 
272
\typeout{Paperwidth=\the\baposter@finalpaperwidth}
273
\typeout{Paperheight=\the\baposter@finalpaperheight}
274
\typeout{BasePaperwidth=\the\baposter@basepaperwidth}
275
\typeout{BasePaperheight=\the\baposter@basepaperheight}
276
\usepackage[
277
   paperwidth=\baposter@basepaperwidth,
278
   paperheight=\baposter@basepaperheight,
279
   tmargin=\baposter@basemargin,
280
   bmargin=\baposter@basemargin,
281
   lmargin=\baposter@basemarginleft,
282
   rmargin=\baposter@basemarginright,
283
   ]{geometry}
284
 
285
\usepackage{pgfpages}
286
\if@landscape
287
\if@geometryKnowsThisSize
288
\pgfpagesuselayout{resize to}[physical paper width=\baposter@finalpaperheight,physical paper height=\baposter@finalpaperwidth]
289
\else
290
\pgfpagesuselayout{resize to}[physical paper width=\baposter@finalpaperwidth,physical paper height=\baposter@finalpaperheight]
291
\fi
292
\else
293
\pgfpagesuselayout{resize to}[physical paper width=\baposter@finalpaperwidth,physical paper height=\baposter@finalpaperheight]
294
\fi
295
 
296
 
297
 
298
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
299
%  Default functions for borders/backgrounds
300
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
301
 
302
%% These functions will all be redefined from the actual option values. In
303
%% particular, they will be set to \baposter@optionname@optionvalue, which
304
%% should do the actual work / setting for that particular optionvalue.
305
 
306
\newcommand{\baposterPosterDrawBackground}[2]{} % Draw poster background
307
 
308
\newcommand{\baposterBoxGetShape}{}             % Returns path of text box shape
309
\newcommand{\baposterBoxDrawBackground}[2]{}    % Draw bg of boxes
310
\newcommand{\baposterBoxDrawBorder}[1]{}        % Draw border of individual boxes
311
 
312
\newcommand{\baposterHeaderGetShape}{}          % Returns path of text box shape
313
\newcommand{\baposterHeaderSetShade}[3]{}       % Set bg style for box headers
314
\newcommand{\baposterHeaderDrawBackground}[3]{} % Draw background of box header
315
\newcommand{\baposterHeaderDrawBorder}[1]{}     % Draw border of box header
316
\newcommand{\baposterHeaderDrawText}[1]{}       % Draw text inside box header
317
 
318
\newcommand{\@@previousbox}{notset}             % stores the previously processed box for below=auto
319
 
320
% Function to set a user-defined background
321
\newcommand{\baposter@backgroundCmd}{\error{No background command defined. Use \background{...} to define background}}
322
\newcommand{\background}[1]{\renewcommand{\baposter@backgroundCmd}{#1}}
323
 
324
 
325
 
326
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327
% Handle poster and box options
328
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
329
 
330
\debug{Handling keys}
331
 
332
%%
333
%% POSTER OPTIONS
334
%%
335
%% Store all poster options in variables of the form \baposter@option
336
%% choose-keys also store the index in \baposter@optionnr
337
%% choose-keys typically also assign a function
338
\definecolor{baposter@silver}{cmyk}{0,0,0,0.7}
339
\define@boolkey[ba]{poster}[baposter@]{grid}                 [false]       {}
340
\define@boolkey[ba]{poster}[baposter@]{eyecatcher}           [true]        {}
341
\define@cmdkey [ba]{poster}[baposter@]{headerheight}         [0.1\textheight]{}
342
\define@cmdkey [ba]{poster}[baposter@]{columns}              [{}]          {}
343
\define@cmdkey [ba]{poster}[baposter@]{colspacing}           [1em]         {}
344
\define@cmdkey [ba]{poster}[baposter@]{bgColorOne}           [baposter@silver]{}
345
\define@cmdkey [ba]{poster}[baposter@]{bgColorTwo}           [green]       {}
346
 
347
% background can be one of: shadeLR, shadeTB, plain, user, none
348
\define@choicekey*+[ba]{poster}{background}%
349
    [\baposter@background\baposter@backgroundnr]%
350
    {shadeLR, shadeTB, plain, user, none} [plain] {%
351
  \debug{Poster background: \baposter@background}
352
  \renewcommand{\baposterPosterDrawBackground}[2]{
353
      \csname baposter@background@\baposter@background\endcsname{##1}{##2}}
354
}{
355
  \PackageWarning{baposter}{Unknown background `\baposter@background' (use
356
      shadeLR, shadeTB, plain, none, or user). If user is used, you also
357
      have to define \background{...}.}
358
  \renewcommand{\baposterPosterDrawBackground}[2]{\baposter@background@none{##1}{##2}}
359
}
360
 
361
 
362
%%
363
%%  BOX OPTIONS
364
%%
365
\define@cmdkey[ba]{posterbox}[baposter@box@]{cornerradius}          [1em]         {}
366
\define@cmdkey[ba]{posterbox}[baposter@box@]{boxheaderheight}       [2em]         {}
367
\define@cmdkey[ba]{posterbox}[baposter@box@]{boxpadding}            [0.5em]       {}
368
 
369
 
370
% textborder can be one of: none, bars, coils, triangles, rectangle, rounded,
371
% roundedleft, roundedsmall, faded; UNIMPLEMENTED: roundedright
372
\edef\baposter@box@textborder@validvalues{none,bars,coils,triangles,rectangle,rounded,roundedleft,roundedsmall,faded}
373
\define@choicekey*+[ba]{posterbox}{textborder}%
374
    [\baposter@box@textborder\baposter@box@textbordernr]%
375
    {none,bars,coils,triangles,rectangle,rounded,roundedleft,roundedright,roundedsmall,faded} [rectangle] {%
376
  \debug{Text border: \baposter@box@textborder}
377
  \renewcommand{\baposterBoxGetShape}{
378
      \csname baposter@box@boxshape@\baposter@box@textborder\endcsname}
379
  \renewcommand{\baposterBoxDrawBorder}[1]{
380
      \csname baposter@box@drawborder@\baposter@box@textborder\endcsname{##1}}
381
}{
382
  \PackageWarning{baposter}{Unknown text-border style `\baposter@box@textborder'.
383
      Edit your file to choose a valid option (\baposter@box@textborder@validvalues).}
384
  \renewcommand{\baposterBoxGetShape}{\baposter@boxshape@rectangle}
385
  \renewcommand{\baposterBoxDrawBorder}[1]{\baposter@drawborder@rectangle{##1}}
386
}
387
 
388
% boxshade can be one of: shadeLR, shadeTB, plain, none
389
\define@choicekey*+[ba]{posterbox}{boxshade}%
390
    [\baposter@box@boxshade\baposter@box@boxshadenr]%
391
    {shadelr,shadetb,plain,none} [none] {%
392
  \debug{Box shade: \baposter@box@boxshade}
393
  \renewcommand{\baposterBoxDrawBackground}[2]{
394
      \csname baposter@box@drawbackground@\baposter@box@boxshade\endcsname{##1}{##2}}
395
}{
396
  \PackageWarning{baposter}{Unknown boxshade style `\baposter@boxshade'.
397
      Edit your file to choose a valid option.}
398
  \renewcommand{\baposterBoxDrawBackground}[2]{\baposter@box@drawbackground@none{##1}{##2}}
399
}
400
 
401
% headershade can be one of: shade-lr, shade-tb, shade-tb-inverse, plain
402
\define@choicekey*+[ba]{posterbox}{headershade}%
403
    [\baposter@box@headershade\baposter@box@headershadenr]%
404
    {shadelr, shadetb, shadetbinverse, plain} [shadelr] {%
405
  \debug{Header shade: \baposter@box@headershade}
406
  \renewcommand{\baposterHeaderSetShade}[3]{
407
      \csname baposter@box@headershade@\baposter@box@headershade\endcsname{##1}{##2}{##3}}
408
}{
409
  \PackageWarning{baposter}{Unknown headershade style `\baposter@box@headershade'.
410
      Edit your file to choose a valid option.}
411
  \renewcommand{\baposterHeaderSetShade}[3]{\baposter@box@headershade@none{##1}{##2}{##3}}
412
}
413
 
414
% headershape can be one of: rectangle, rounded, smallrounded, roundedleft, roundedright
415
\define@choicekey*+[ba]{posterbox}{headershape}%
416
    [\baposter@box@headershape\baposter@box@headershapenr]%
417
    {rectangle,rounded,smallrounded,roundedleft,roundedright} [roundedright] {%
418
  \debug{Header shape: \baposter@box@headershape}
419
  \renewcommand{\baposterHeaderGetShape}{
420
      \csname baposter@box@headershape@\baposter@box@headershape\endcsname}
421
  \renewcommand{\baposterHeaderDrawText}[1]{
422
      \csname baposter@box@headerdrawtext@\baposter@box@headershape\endcsname{##1}}
423
  \renewcommand{\baposterHeaderDrawBorder}[1]{
424
      \csname baposter@box@headerdrawborder@\baposter@box@headershape\endcsname{##1}}
425
}{
426
  \PackageWarning{baposter}{Unknown headershape style `\baposter@headershape'.
427
      Edit your file to choose a valid option.}
428
  \renewcommand{\baposterHeaderGetShape}{\baposter@box@headershape@rectangle}
429
  \renewcommand{\baposterHeaderDrawText}[1]{\baposter@box@headerdrawtext@rectangle{##1}}
430
  \renewcommand{\baposterHeaderDrawBorder}[1]{\baposter@box@headerdrawborder@rectangle{##1}}
431
}
432
 
433
% headerborder can be one of: open, closed, none
434
\define@choicekey*+[ba]{posterbox}{headerborder}%
435
    [\baposter@box@headerborder\baposter@box@headerbordernr]%
436
    {open,closed,none} [open] {%
437
  \debug{Header border: \baposter@box@headerborder}
438
%   \renewcommand{\baposterHeaderBorder}{
439
%       \csname baposter@headerborder@\baposter@box@headerborder\endcsname}
440
}{
441
  \PackageWarning{baposter}{Unknown headerborder style `\baposter@headerborder'.
442
      Edit your file to choose a valid option.}
443
%   \renewcommand{\baposterHeaderBorder}{\baposter@box@headerborder@rectangle}
444
}
445
 
446
 
447
\define@cmdkey[ba]{posterbox}[baposter@box@]{borderColor}           [yellow]      {}
448
\define@cmdkey[ba]{posterbox}[baposter@box@]{headerColorOne}        [red]         {}
449
\define@cmdkey[ba]{posterbox}[baposter@box@]{headerColorTwo}        [brown]       {}
450
\define@cmdkey[ba]{posterbox}[baposter@box@]{headerFontColor}       [black]       {}
451
\define@cmdkey[ba]{posterbox}[baposter@box@]{boxColorOne}           [magenta]     {}
452
\define@cmdkey[ba]{posterbox}[baposter@box@]{boxColorTwo}           [cyan]        {}
453
\define@cmdkey[ba]{posterbox}[baposter@box@]{headerfont}            [\scshape\Large]   {}
454
\define@cmdkey[ba]{posterbox}[baposter@box@]{textfont}              [{}]          {}
455
 
456
\define@cmdkey[ba]{posterbox}[baposter@box@]{linewidth}             [2pt]         {}
457
 
458
\define@cmdkey[ba]{posterbox}[baposter@box@]{below}  [notset]{}
459
\define@cmdkey[ba]{posterbox}[baposter@box@]{above}  [notset]{}
460
\define@cmdkey[ba]{posterbox}[baposter@box@]{aligned}[notset]{}
461
\define@cmdkey[ba]{posterbox}[baposter@box@]{bottomaligned}[notset]{}
462
\define@cmdkey[ba]{posterbox}[baposter@box@]{column} [0]     {}
463
\define@cmdkey[ba]{posterbox}[baposter@box@]{row}    [0]     {}
464
\define@cmdkey[ba]{posterbox}[baposter@box@]{span}   [1]     {}
465
\define@cmdkey[ba]{posterbox}[baposter@box@]{height} [auto]  {}
466
\define@cmdkey[ba]{posterbox}[baposter@box@]{name}   [noname]{}
467
 
468
% Set some default values, the poster and posterbox environments can override:
469
\setkeys[ba]{poster}{
470
  % Debug grid
471
  grid=false,
472
  % Is there an eyecatcher image
473
  eyecatcher=true,
474
  columns={},
475
  % Colours
476
  bgColorOne=baposter@silver,
477
  bgColorTwo=green,
478
  %
479
  colspacing=1em,
480
  headerheight=0.1\textheight,
481
  background=shadeLR,
482
}{}
483
\setkeys[ba]{posterbox}{
484
  % Position
485
  column=0,row=0,span=1,
486
  below=notset,above=notset,
487
  bottomaligned=notset,
488
  aligned=notset,
489
  height=auto,
490
  % Name
491
  name=noname,
492
  % Box design: border:
493
  linewidth=2pt,
494
  borderColor=yellow,
495
  cornerradius=1em,
496
  % text box:
497
  textfont={},
498
  boxshade=plain,
499
  boxColorOne=magenta,
500
  boxColorTwo=cyan,
501
  textborder=faded,
502
  boxpadding=0.5em,
503
  % header
504
  headerfont=\scshape\Large,% or headerfont=\color{white}\textsf\textbf
505
  headerFontColor=black,
506
  headerColorOne=red,
507
  headerColorTwo=brown,
508
  headershape=rectangle,
509
  headershade=shadeLR,
510
  headerborder=none,
511
  boxheaderheight=2em,
512
}{}
513
 
514
 
515
 
516
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
517
%%% Background options and functions (one function for each possible value)
518
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
519
 
520
\newcommand{\baposter@background@shadelr}[2]{
521
  \debug{BAPOSTER: Using shade left right background.}
522
  \begin{tikzpicture}[remember picture,overlay]%
523
    \shade [shading=axis,left color=#1,right color=#2] (current page.north west)
524
           rectangle(current page.south east);
525
  \end{tikzpicture}%
526
}
527
\newcommand{\baposter@background@shadetb}[2]{
528
  \debug{BAPOSTER: Using shade top to bottom background.}
529
  \begin{tikzpicture}[remember picture,overlay]%
530
    \shade [shading=axis,top color=#1,bottom color=#2] (current page.north west)
531
           rectangle(current page.south east);
532
  \end{tikzpicture}%
533
}
534
\newcommand{\baposter@background@plain}[2]{
535
  \debug{BAPOSTER: Using plain background.}
536
  \begin{tikzpicture}[remember picture,overlay]%
537
    \fill [fill=#1] (current page.north west) rectangle(current page.south east);
538
  \end{tikzpicture}%
539
}
540
\newcommand{\baposter@background@user}[2]{
541
  \debug{BAPOSTER: Using user background.}
542
  \baposter@backgroundCmd%
543
}
544
\newcommand{\baposter@background@none}[2]{
545
  \debug{BAPOSTER: Using no background.}
546
}
547
 
548
 
549
 
550
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
551
%%% Return shape path of text box (depending on the box shape)
552
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
553
 
554
\newcommand{\baposter@box@boxshape@none}{\baposter@box@boxshape@rectangle}
555
\newcommand{\baposter@box@boxshape@bars}{
556
  (\baposter@box@name tnw) -- (\baposter@box@name sw) %
557
  (\baposter@box@name se) -- (\baposter@box@name tne)
558
}
559
\newcommand{\baposter@box@boxshape@coils}{\baposter@box@boxshape@bars}
560
\newcommand{\baposter@box@boxshape@triangles}{\baposter@box@boxshape@bars}
561
\newcommand{\baposter@box@boxshape@rectangle}{
562
  (\baposter@box@name tnw) -- (\baposter@box@name sw) -- %
563
  (\baposter@box@name se) -- (\baposter@box@name tne)%
564
}
565
\newcommand{\baposter@box@boxshape@faded}{
566
  (\baposter@box@name tnw) -- (\baposter@box@name sw) %
567
  (\baposter@box@name tne) -- (\baposter@box@name se)
568
  }
569
\newcommand{\baposter@box@boxshape@rounded}{
570
  [rc] \baposter@box@boxshape@rectangle%
571
}
572
\newcommand{\baposter@box@boxshape@roundedsmall}{
573
  [src] \baposter@box@boxshape@rectangle
574
}
575
\newcommand{\baposter@box@boxshape@roundedleft}{
576
  (\baposter@box@name tnw) {[rc]-- (\baposter@box@name sw)} -- %
577
  (\baposter@box@name se) -- (\baposter@box@name tne)%
578
}
579
\newcommand{\baposter@box@boxshape@roundedright}{
580
  (\baposter@box@name tnw) -- (\baposter@box@name sw) {[rc]-- %
581
  (\baposter@box@name se)} -- (\baposter@box@name tne)%
582
}
583
 
584
 
585
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
586
%%% Draw box background (one function for each possible value)
587
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
588
 
589
% These functions take no arguments
590
\newcommand{\baposter@box@drawbackground@none}[2]{
591
  \tikzstyle{box colors}=[]
592
}
593
\newcommand{\baposter@box@drawbackground@plain}[2]{
594
  \tikzstyle{box colors}=[fill=#1]
595
  \fill[box colors] \baposterBoxGetShape;
596
}
597
\newcommand{\baposter@box@drawbackground@shadelr}[2]{
598
  \tikzstyle{box colors}=[shading=axis, left color=#1, right color=#2]%
599
  \fill[box colors] \baposterBoxGetShape;
600
}
601
\newcommand{\baposter@box@drawbackground@shadetb}[2]{
602
  \tikzstyle{box colors}=[shading=axis, top color=#1, bottom color=#2]%
603
  \fill[box colors] \baposterBoxGetShape;
604
}
605
 
606
 
607
 
608
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
609
%%% Draw box border
610
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
611
 
612
% These functions take two arguments: borderColor
613
\newcommand{\baposter@box@drawborder@none}[1]{}
614
\newcommand{\baposter@box@drawborder@bars}[1]{
615
  \draw[color=#1] \baposterBoxGetShape;%
616
}
617
\newcommand{\baposter@box@drawborder@coils}[1]{
618
  \draw[color=#1,segment amplitude=0.35em,segment length=0.4em,snake=coil] \baposterBoxGetShape;%
619
}
620
\newcommand{\baposter@box@drawborder@triangles}[1]{
621
  \draw[color=#1,segment amplitude=0.2em,segment length=0.4em,snake=triangles] \baposterBoxGetShape;%
622
}
623
\newcommand{\baposter@box@drawborder@rectangle}[1]{
624
  \draw[color=#1] \baposterBoxGetShape;%
625
}
626
\newcommand{\baposter@box@drawborder@rounded}[1]{
627
  \draw[color=#1] \baposterBoxGetShape;%
628
}
629
\newcommand{\baposter@box@drawborder@roundedleft}[1]{
630
  \draw[color=#1] \baposterBoxGetShape;%
631
}
632
\newcommand{\baposter@box@drawborder@roundedright}[1]{
633
  \draw[color=#1] \baposterBoxGetShape;%
634
}
635
\newcommand{\baposter@box@drawborder@faded}[1]{
636
  % This is the right way to do it, but it does not work with evince, and has problems during printing, so instead we do
637
  %\draw[color=#1,path fading=south] \baposterBoxGetShape;%
638
  % this
639
  \foreach \x in {0,1,...,90} \draw[color=#1!\x] ($(\baposter@box@name tnw)!{(100-\x)/100}!(\baposter@box@name sw)$) -- ($(\baposter@box@name tnw)!{(100-(\x+10))/100}!(\baposter@box@name sw)$);%
640
  \foreach \x in {0,1,...,90} \draw[color=#1!\x] ($(\baposter@box@name tne)!{(100-\x)/100}!(\baposter@box@name se)$) -- ($(\baposter@box@name tne)!{(100-(\x+10))/100}!(\baposter@box@name se)$);%
641
}
642
\newcommand{\baposter@box@drawborder@roundedsmall}[1]{
643
  \draw[color=#1] \baposterBoxGetShape;%
644
}
645
 
646
 
647
 
648
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
649
%%% Return shape path of text box (depending on the box shape)
650
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
651
 
652
% These functions take no arguments
653
% TODO: For headerborder==none, use (\baposter@box@name outer tnw) instead!
654
\newcommand{\baposter@box@headershape@rectangle}{%
655
  (\baposter@box@name tnw) -- (\baposter@box@name nw) -- %
656
  (\baposter@box@name ne) -- (\baposter@box@name tne)%
657
}
658
\newcommand{\baposter@box@headershape@smallrounded}{%
659
  (\baposter@box@name tnw) {[src] -- (\baposter@box@name nw) -- %
660
  (\baposter@box@name ne)} -- (\baposter@box@name tne)%
661
}
662
\newcommand{\baposter@box@headershape@roundedright}{%
663
  (\baposter@box@name tnw) -- (\baposter@box@name nw) {[rc] -- %
664
  (\baposter@box@name ne)} -- (\baposter@box@name tne)%
665
}
666
\newcommand{\baposter@box@headershape@roundedleft}{%
667
  (\baposter@box@name tnw) {[rc]-- (\baposter@box@name nw)} -- %
668
  (\baposter@box@name ne) -- (\baposter@box@name tne)%
669
}
670
\newcommand{\baposter@box@headershape@rounded}{%
671
  (\baposter@box@name tnw) {[rc] -- (\baposter@box@name nw) -- %
672
  (\baposter@box@name ne) } -- (\baposter@box@name tne)%
673
}
674
 
675
 
676
 
677
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
678
%%% Header text drawing (one function for each possible value of headershape)
679
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
680
 
681
% These functions take one argument: the header text
682
\newcommand{\baposter@box@headerdrawtext@rectangle}[1]{
683
  \path (\baposter@box@name nw) +(0em,-0.5\baposter@box@@boxheaderheight) node[anchor=west,inner sep=0.4em] {#1};%
684
}
685
\newcommand{\baposter@box@headerdrawtext@smallrounded}[1]{
686
  \path (\baposter@box@name nw) +(0.5\boxwidth,-0.5\baposter@box@@boxheaderheight) node[anchor=center] {#1};%
687
}
688
\newcommand{\baposter@box@headerdrawtext@roundedright}[1]{
689
  \path (\baposter@box@name nw) +(0em,-0.5\baposter@box@@boxheaderheight)%
690
        node[anchor=west,inner sep=0.4em,text depth=0.0em] {#1};%
691
}
692
\newcommand{\baposter@box@headerdrawtext@roundedleft}[1]{
693
  \path (\baposter@box@name nw) +(0em,-0.5\baposter@box@@boxheaderheight)%
694
        node[anchor=west,inner sep=0.4em] {#1};%
695
}
696
\newcommand{\baposter@box@headerdrawtext@rounded}[1]{
697
    \path (\baposter@box@name nw) +(0.5\boxwidth,-0.5\baposter@box@@boxheaderheight) node[anchor=center] {#1};%
698
}
699
 
700
 
701
 
702
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
703
%%% Header shade options and functions (one function for each possible value)
704
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
705
 
706
% These functions take two arguments: headerColorOne, headerColorTwo and borderColor
707
\newcommand{\baposter@box@headershade@shadelr}[3]{
708
    \debug{Header-Shade: Shade Left - Right}
709
    \tikzstyle{header colors}=[%
710
      color=#3,%
711
      shading=axis,%
712
      left color=#1,%
713
      right color=#2%
714
    ]%
715
}
716
\newcommand{\baposter@box@headershade@shadetb}[3]{
717
    \debug{Header-Shade: Shade Top - Bottom}
718
    \tikzstyle{header colors}=[%
719
      color=#3,%
720
      shading=axis,%
721
      top color=#1,%
722
      bottom color=#2%
723
    ]%
724
}
725
\newcommand{\baposter@box@headershade@shadetbinverse}[3]{
726
    \tikzstyle{header colors}=[%
727
      top color=#1!75!#2,%
728
      bottom color=#2!100!#1,%
729
      shading angle=20%
730
    ]%
731
    \colorlet{baposterHeaderFontColor}{white}%
732
}
733
\newcommand{\baposter@box@headershade@plain}[3]{
734
    \debug{Header-Shade: Plain}
735
    \tikzstyle{header colors}=[%
736
      color=#3,%
737
      fill=#1%
738
    ]%
739
}
740
\newcommand{\baposter@box@headershade@none}[3]{
741
    \debug{Header-Shade: none}
742
    \tikzstyle{header colors}=[]
743
}
744
 
745
 
746
 
747
 
748
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
749
%%% The main poster environment
750
%%% \begin{baposter}{settings}{Eye Catcher}{Title}{Author}{University Logo}
751
%%%-----------------------------------------------------------------------------
752
%%% The settings are
753
%%%   - grid=true,[false]:Show grid to help with alignment
754
%%%   - colspacing=0.7em: Column spacing
755
%%%   - columns=4:        number of columns (default 4 in landscape and 3 in portrait format) (maximum number is 6)
756
%%%   - color=[orange]:   xcolor color definition used as the main color of the poster
757
%%%   - colortwo=[white]: The other color for gradient based layouts
758
%%%   - textborder=none,bars,coils,triangles,rectangle,rounded,roundedsmall,roundedleft,roundedright,[faded]
759
%%%                       The style of the box around the text area
760
%%%   - headerborder=none,closed,open
761
%%%                       No extra border around box header, full border around box header or border that is open below.
762
%%%   - headershape=rectangle,rounded,roundedleft,roundedright
763
%%%                       Shape of the box-header region
764
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
765
\newenvironment{poster}[5]{%
766
  \thispagestyle{empty}% Suppress Page Number
767
  \debug{Poster Starts}%
768
  % This setkeys call parses all provided options and depending on the option
769
  % value, assigns different handler functions to the \baposter(Box|Header)*
770
  % functions. Once that is done, we don't have to care about particular
771
  % values for border, shading, etc. All we have to do is call the
772
  % handler functions and let them do their job.
773
  % This also allows the user to override the poster-wide defaults on a per-box
774
  % basis.
775
  \setkeys[ba]{posterbox,poster}{#1}%
776
%
777
  % TODO: Move all those assignments to the key macros!
778
  % Parse Keys%
779
  \colorlet{bgColorOne}{\baposter@bgColorOne}
780
  \colorlet{bgColorTwo}{\baposter@bgColorTwo}
781
%
782
  %% Boxes%
783
  \setlength{\headerheight}{\baposter@headerheight}%
784
  \setlength{\colheight}{\textheight-\baposter@headerheight}%
785
  \renewcommand{\@@previousbox}{notset}
786
 
787
  \debug{Format}%
788
  % Set default for columns if unset (4 for landscape, 3 for portrait)
789
  \ifthenelse{\equal{\baposter@columns}{}}{%
790
    \renewcommand{\baposter@columns}{\if@landscape4\else3\fi}%
791
  }{}
792
%
793
  \debug{Columns: \baposter@columns}%
794
  \setlength{\baposter@@colspacing}{\baposter@colspacing}%
795
  \setlength{\colwidth}{\textwidth}%
796
  \addtolength{\colwidth}{\baposter@@colspacing*(1-\baposter@columns)}%
797
  \ifcase\baposter@columns\relax
798
    \error{You need to have at least one column!}
799
  \or % 1
800
    \setlength{\colwidth}{\colwidth}%
801
  \or % 2
802
    \setlength{\colwidth}{0.5\colwidth}%
803
  \or % 3
804
    \setlength{\colwidth}{0.3333333333333\colwidth}%
805
  \or % 4
806
    \setlength{\colwidth}{0.25\colwidth}%
807
  \or % 5
808
    \setlength{\colwidth}{0.2\colwidth}%
809
  \or % 6
810
    \setlength{\colwidth}{0.16666666666\colwidth}%
811
  \else % >6
812
    \error{You do not want so many columns}
813
  \fi
814
%
815
  \newcommand{\baposter@reference}{north west}%
816
%
817
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
818
  % A box with a header and some content. The basic unit of the poster%
819
  %---------------------------------------------------------------------------%
820
  % Each box has a name and can be placed absolutely or relatively.%
821
  % The only inconvenience is that you can only specify a relative position %
822
  % towards an already declared box. So if you have a box attached to the %
823
  % bottom, one to the top and a third one which should be inbetween, you %
824
  % have to specify the top and bottom boxes before you specify the middle %
825
  % box.%
826
  %%
827
  % below=  name of other node%
828
  % above=  name of other node%
829
  % aligned=name of other node%
830
  % bottomaligned=name of other node%
831
  % column= [0]     %
832
  % row=    [0]     %
833
  % span=   [1]     %
834
  % height= ,[auto]%
835
  % name=   [noname]%
836
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
837
 
838
  % Backward-compatibility definition (\headerbox command uses posterbox env):
839
  \newcommand{\headerbox}[3]{%
840
    \begin{posterbox}[##2]{##1}
841
      ##3
842
    \end{posterbox}
843
  }
844
 
845
  \newenvironment{posterbox}[2][]{%
846
    \debug{Poster box options: ##1}%
847
    % Override the poster-wide defaults on a per-box basis
848
    \setkeys[ba]{posterbox}{##1}%
849
%
850
    \def\baposter@box@title{##2}
851
%
852
    \colorlet{borderColor}{\baposter@box@borderColor}
853
    \colorlet{headerColorOne}{\baposter@box@headerColorOne}
854
    \colorlet{headerColorTwo}{\baposter@box@headerColorTwo}
855
    \colorlet{headerFontColor}{\baposter@box@headerFontColor}
856
    \colorlet{boxColorOne}{\baposter@box@boxColorOne}
857
    \colorlet{boxColorTwo}{\baposter@box@boxColorTwo}
858
%
859
    \setlength{\baposter@box@@cornerradius}{\baposter@box@cornerradius}%
860
    \setlength{\baposter@box@@boxheaderheight}{\baposter@box@boxheaderheight}%
861
    \setlength{\baposter@box@@boxpadding}{\baposter@box@boxpadding}%
862
 
863
 
864
    %% The columns is always given absolute
865
    % boxstartx = column * colwidth + column * colspacing
866
    \setlength{\boxstartx}{(\colwidth+\baposter@@colspacing)*\baposter@box@column}%
867
%
868
    %% The width is gvien absolute
869
    % Box Width = span * colwidth + (span-1) * colspacing
870
    \setlength{\boxwidth}{\baposter@box@span\colwidth} %
871
    \addtolength{\boxwidth}{\baposter@@colspacing*(\baposter@box@span-1)}%
872
%
873
    %% Measure the content of the box%
874
    \setbox\baposter@box@content=\hbox\bgroup%
875
      \begin{pgfinterruptpicture}%
876
        \begin{minipage}[t]{\boxwidth-\baposter@box@@boxpadding*2}%
877
          \baposter@box@textfont\bgroup%
878
  }% End of posterbox preamble
879
  %%% HERE COME THE ACTUAL CONTENTS OF THE HEADERBOX ENVIRONMENT
880
  {% posterbox handling after contents (i.e. drawing everything)
881
          \egroup%
882
        \end{minipage}%
883
      \end{pgfinterruptpicture}%
884
    \egroup%
885
    \setlength{\boxheight}{\ht\baposter@box@content}%
886
    \addtolength{\boxheight}{\dp\baposter@box@content}%
887
    \addtolength{\boxheight}{\baposter@box@@boxheaderheight} % Header%
888
    \addtolength{\boxheight}{2\baposter@box@@boxpadding} % Inner Sep
889
%
890
    \ifthenelse{\equal{\baposter@box@height}{bottom}}{%
891
    }{\ifthenelse{\equal{\baposter@box@height}{auto}}{%
892
    }{ % Neither auto nor bottom%
893
      \setlength{\boxheight}{\baposter@box@height\colheight}%
894
    }}%
895
%
896
    %% Determine the box position%
897
    \debug{Setting Coordinates}%
898
    \debug{Upper Right}%
899
    \debug{\baposter@box@name}%
900
%
901
    %%% Upper Right Corner%
902
    % if below=auto, set it to the previous box
903
    % TODO: We should generalize this to the previous box of the used column,
904
    %       currently we use the previous box, which might be in a different column
905
    \ifthenelse{\equal{\baposter@box@below}{auto}}{%
906
        \edef\baposter@box@below{\@@previousbox}
907
        \debug{Box \baposter@box@name  has below=auto, placing it below box \baposter@box@below.}
908
    }{}
909
    \xdef\@@previousbox{\baposter@box@name}
910
 
911
    \ifthenelse{\not\equal{\baposter@box@below}{notset} }{%
912
      %% Below%
913
      \debug{Below}%
914
      \path[shape=coordinate] (\boxstartx,0pt |- \baposter@box@below se) ++(0pt,-\baposter@@colspacing) coordinate(\baposter@box@name nw);%
915
    }{%
916
      \ifthenelse{\not\equal{\baposter@box@aligned}{notset} }{%
917
        %% Aligned%
918
        \debug{Aligned: \baposter@box@aligned}%
919
        \path[shape=coordinate] (\boxstartx,0pt |- \baposter@box@aligned nw)                           coordinate(\baposter@box@name nw);%
920
      }{%
921
        %% Fixed%
922
        \debug{Fixed}%
923
        \setlength{\boxstarty}{\baposter@box@row\colheight}%
924
        \path[shape=coordinate] (\boxstartx,\colheight-\boxstarty)                                                  coordinate(\baposter@box@name nw);%
925
    }}%
926
%
927
    %% Lower Left Corner%
928
    \debug{Lower Left}%
929
    \ifthenelse{\equal{\baposter@box@above}{bottom}}{%
930
      %% Above = Bottom%
931
      \debug{Above bottom}%
932
      \ifthenelse{\equal{\baposter@box@below}{notset} \and \equal{\baposter@box@aligned}{notset}}{%
933
      \path[shape=coordinate] (\boxstartx,\boxheight)                                                              coordinate(\baposter@box@name nw);%
934
      }{}%
935
      \path[shape=coordinate] (\boxstartx+\boxwidth,0pt)                                                           coordinate(\baposter@box@name se);%
936
      }{\ifthenelse{\not \equal{\baposter@box@bottomaligned}{notset}}{%
937
        \path[shape=coordinate] (\boxstartx+\boxwidth,0pt |- \baposter@box@bottomaligned se)                       coordinate(\baposter@box@name se);%
938
      }{{\ifthenelse{\not \equal{\baposter@box@above}{notset}}{%
939
        %% Above = Node%
940
        \path[shape=coordinate] (\boxstartx+\boxwidth,0pt |- \baposter@box@above nw)  +(0pt,\baposter@@colspacing) coordinate(\baposter@box@name se);%
941
      }{%
942
        %% Above = notset%
943
        \debug{Above=not set}%
944
        \ifthenelse{\equal{\baposter@box@height}{bottom}}{%
945
          %% height=bottom%
946
          \debug{height=bottom}%
947
          \path[shape=coordinate] (\boxstartx+\boxwidth,0pt)                                                       coordinate(\baposter@box@name se);%
948
        }{ %% height=auto or fixed%
949
          \debug{height=auto or fixed}%
950
          \path[shape=coordinate] (\baposter@box@name nw) ++(\boxwidth,-\boxheight)                                coordinate(\baposter@box@name se);%
951
          }}}}}%
952
%
953
        %
954
    % Set coordinates relative to nw,se%
955
    \debug{Fixing Coordinates}%
956
    \path[shape=coordinate]%
957
      (\baposter@box@name nw) +(0pt,-\baposter@box@@boxheaderheight)                coordinate(\baposter@box@name tnw)%
958
      (\baposter@box@name nw |- \baposter@box@name se)   coordinate(\baposter@box@name sw)%
959
      (\baposter@box@name se |- \baposter@box@name nw)   coordinate(\baposter@box@name ne)%
960
      (\baposter@box@name ne) +(0pt,-\baposter@box@@boxheaderheight)                coordinate(\baposter@box@name tne)%
961
%
962
      (\baposter@box@name nw)  +(-0.025em,0pt)           coordinate(\baposter@box@name outer nw)%
963
      (\baposter@box@name tnw) +(-0.025em,0pt)           coordinate(\baposter@box@name outer tnw)%
964
      (\baposter@box@name sw)  +(-0.025em,0pt)           coordinate(\baposter@box@name outer sw)%
965
%
966
      (\baposter@box@name ne)  +( 0.025em,0pt)           coordinate(\baposter@box@name outer ne)%
967
      (\baposter@box@name tne) +( 0.025em,0pt)           coordinate(\baposter@box@name outer tne)%
968
      (\baposter@box@name se)  +( 0.025em,0pt)           coordinate(\baposter@box@name outer se);%
969
%
970
      %% Setting the bg colors of the box header
971
      \baposterHeaderSetShade{headerColorOne}{headerColorTwo}{borderColor}
972
%
973
      \tikzstyle{rc}=[rounded corners=\baposter@box@@cornerradius];%
974
      \tikzstyle{src}=[rounded corners=0.5em];%
975
%
976
 
977
    %% Now that everything is set up, draw the actual box, with bg and header
978
    \begin{scope}[line width=\baposter@box@linewidth]
979
      %% Header%
980
      \debug{Header}%
981
      \debug{Header-Shape: \baposter@box@headershape, header-border: \baposter@box@headerborder (\baposter@box@headerbordernr)}%
982
      % TODO: Also turn this last ifcase construct into a handler function
983
      %       We only need to determine (fill|shade)(draw|)...
984
%       \baposterHeaderDrawBackground{bgColorOne}{bgColorTwo}{borderColor}
985
%       \baposterHeaderDrawBorder{borderColor}
986
      \ifcase\baposter@box@headerbordernr\relax%
987
        % open
988
        \ifthenelse{\equal{\baposter@box@headershade}{plain}}{
989
          \filldraw  [style=header colors] \baposterHeaderGetShape;%
990
        }{
991
          \shadedraw [style=header colors] \baposterHeaderGetShape;%
992
        }
993
      \or
994
        % closed
995
        \ifthenelse{\equal{\baposter@box@headershade}{plain}}{
996
          \filldraw  [style=header colors] \baposterHeaderGetShape -- cycle;%
997
        }{
998
          \shadedraw [style=header colors] \baposterHeaderGetShape -- cycle;%
999
        }
1000
      \or
1001
        % none
1002
        \ifthenelse{\equal{\baposter@box@headershade}{plain}}{
1003
          \fill      [style=header colors] \baposterHeaderGetShape;%
1004
        }{
1005
          \shade     [style=header colors] \baposterHeaderGetShape;%
1006
        }
1007
      \fi
1008
      %
1009
      %% Draw the text inside the box header:
1010
      \baposterHeaderDrawText{\color{headerFontColor}\baposter@box@headerfont{\baposter@box@title}};%
1011
      %
1012
      %% Text borders (border around boxes)
1013
      \debug{Poster boxes}%
1014
      % First set box shade
1015
      \baposterBoxDrawBackground{boxColorOne}{boxColorTwo}
1016
      \baposterBoxDrawBorder{borderColor}
1017
      %%
1018
      %% Text Box%
1019
      \debug{Drawing Text}%
1020
      \path (\baposter@box@name tnw) node(text) [anchor=north west,
1021
            outer sep=-0.000em,text width=\boxwidth-2\baposter@box@@boxpadding,inner sep=\baposter@box@@boxpadding,
1022
            text justified] {\usebox{\baposter@box@content}};%
1023
    \end{scope}
1024
    %
1025
    % Finally store the box name as the previous box for the next call
1026
%     \xdef\@@previousbox{\baposter@box@name}%
1027
  }% END of posterbox definition
1028
%
1029
  %% Poster Background%
1030
  \baposterPosterDrawBackground{bgColorOne}{bgColorTwo}%
1031
  %% Poster header/title
1032
  \hspace{-1.5em}%
1033
  \begin{tikzpicture}[inner sep=0pt,outer sep=0pt,line width=0.05em]%
1034
    \useasboundingbox (0em,0em) rectangle(\textwidth,\textheight);%
1035
    \path[shape=coordinate]%
1036
      (0pt,\colheight) coordinate(north west) (\textwidth,\colheight) coordinate(north east)%
1037
      (0pt,0pt) coordinate(south west)        (\textwidth,0pt) coordinate(south east);%
1038
%
1039
    \ifbaposter@eyecatcher% Has eye catcher
1040
      \debug{Eyecatcher found!}
1041
      \setbox\baposter@titleimage@left=\hbox{#2}%
1042
    \else% Has no eye catcher%
1043
      \setbox\baposter@titleimage@left=\hbox{}%
1044
    \fi%
1045
    \setlength{\baposter@titleimage@left@width}{\wd\baposter@titleimage@left}%
1046
    \setbox\baposter@titleimage@right=\hbox{#5}%
1047
    \setlength{\baposter@titleimage@right@width}{\wd\baposter@titleimage@right}%
1048
    \setlength{\baposter@titleimage@textwidth}{\textwidth}%
1049
    \addtolength{\baposter@titleimage@textwidth}{-\baposter@titleimage@left@width}%
1050
    \addtolength{\baposter@titleimage@textwidth}{-\baposter@titleimage@right@width}%
1051
 
1052
    \debug{#3}
1053
    %
1054
    %
1055
    %      % Draw Header%
1056
    \draw (north west) +(0em,1em+0.5\headerheight) node(image)[anchor=west]   { {\usebox{\baposter@titleimage@left }} };%
1057
    \draw (north east) +(0em,1em+0.5\headerheight) node(logo) [anchor=east]   { {\usebox{\baposter@titleimage@right}} };%
1058
    %
1059
    \ifbaposter@eyecatcher% Has eye catcher%
1060
      \draw (image.east) node(title)[anchor=west,text width=\baposter@titleimage@textwidth]{%
1061
        \begin{minipage}{\baposter@titleimage@textwidth}%
1062
          \begin{center}%
1063
          \textbf{\Huge #3}\\%
1064
          {\Large #4}%
1065
          \end{center}%
1066
        \end{minipage}
1067
      };%
1068
    \else% Has no eye catcher
1069
      \draw (image.east) node(title)[anchor=west]  { {\begin{minipage}{\baposter@titleimage@textwidth}{\bfseries\Huge #3}\\{\Large #4}\end{minipage}} };%
1070
    \fi
1071
  }% END poster begin
1072
% The body
1073
  {% BEGIN poster end
1074
    % The end, draw gridlines if neccesary
1075
    \ifbaposter@grid
1076
      \newdimen{\gridpos}
1077
      \pgfmathsetmacro{\z}{\baposter@columns-1}
1078
      \foreach \y in {0,...,\z}
1079
      {
1080
        \setlength{\gridpos}{\y\colwidth+\y\baposter@@colspacing}
1081
        \draw[draw=green,draw opacity=0.7] (\gridpos,0pt)  -- (\gridpos,\colheight)
1082
            (\gridpos+\colwidth,0pt)  -- (\gridpos+\colwidth,\colheight);%
1083
      }
1084
      % Horizontal lines, every 0.1:
1085
      %% Explicitly list all percentages, because with {0.0, 0.1, ..., 1.0} we
1086
      %% get rounding errors in the displayed numbers!
1087
      \foreach \y in {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}
1088
        \draw[draw=green,draw opacity=0.7] (0pt,\colheight-\y\colheight)  --
1089
            (\textwidth,\colheight-\y\colheight) node[anchor=west] {\y};%
1090
    \fi%
1091
  \end{tikzpicture}%
1092
 % \xkvview{}
1093
 \par
1094
  }% END poster end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.