NAME
LaTeX::Table::Themes::ThemeI - Interface for LaTeX table themes.
SYNOPSIS
package MyThemes::Custom;
use Moose;
with 'LaTeX::Table::Themes::ThemeI';
sub _definition {
return { CENTRALPARK =>
{
'HEADER_FONT_STYLE' => 'bf',
'HEADER_FONT_COLOR' => 'white',
'HEADER_BG_COLOR' => 'latextbl',
'DATA_BG_COLOR_ODD' => 'latextbl!25',
'DATA_BG_COLOR_EVEN' => 'latextbl!10',
'DEFINE_COLORS' => '\definecolor{latextbl}{RGB}{93,127,114}',
'HEADER_CENTERED' => 1,
'VERTICAL_LINES' => [ 1, 0, 0 ],
'HORIZONTAL_LINES' => [ 1, 1, 0 ],
'BOOKTABS' => 0,
'EXTRA_ROW_HEIGHT' => '1pt',
}};
}
1;
..
$table->search_path( add => 'MyThemes');
DESCRIPTION
This is the theme interface (or Moose role), that all theme objects must use.
CREATING THEMES
A theme is defined as an hash reference containing all options:
# a very ugly theme...
my $theme = {
'Duisburg' => {
'HEADER_FONT_STYLE' => 'sc',
'HEADER_FONT_COLOR' => 'white',
'HEADER_BG_COLOR' => 'blue',
'HEADER_CENTERED' => 1,
'DATA_BG_COLOR_ODD' => 'blue!30',
'DATA_BG_COLOR_EVEN' => 'blue!10',
'CAPTION_FONT_STYLE' => 'sc',
'VERTICAL_LINES' => [ 1, 2, 1 ],
'HORIZONTAL_LINES' => [ 1, 2, 0 ],
'EXTRA_ROW_HEIGHT' => '2pt',
'BOOKTABS' => 0,
},
};
- Fonts
-
HEADER_FONT_STYLE
,CAPTION_FONT_STYLE
. Valid values are bf (bold), it (italics), sc (caps) and tt (typewriter). When this option is undef, then header (or caption, respectively) is written in normal font. - Colors
-
HEADER_FONT_COLOR
can be used to specify a different font color for the header. Requires thexcolor
LaTeX package.Set
HEADER_BG_COLOR
to use a background color in the header,DATA_BG_COLOR_EVEN
andDATA_BG_COLOR_ODD
for even and odd data rows. Requires thecolortbl
and thexcolor
LaTeX package.You can define colors with
DEFINE_COLORS
, for example:'DEFINE_COLORS' => '\definecolor{latextbl}{RGB}{78,130,190}',
- Lines
-
VERTICAL_LINES
,HORIZONTAL_LINES
. A reference to an array with three integers, e.g.[ 1, 2, 0 ]
. The first integer defines the number of outer lines. The second the number of lines after the header and after the first column. The third is the number of inner lines. For example Dresden is defined as:'Dresden' => { ... 'VERTICAL_LINES' => [ 1, 2, 1 ], 'HORIZONTAL_LINES' => [ 1, 2, 0 ], }
The first integers define one outer line - vertical and horizontal. So a box is drawn around the table. The second integers define two lines between header and table and two vertical lines between first and second column. And finally the third integers define that columns are separated by a single vertical line whereas rows are not separated by horizontal lines.
- Misc
-
EXTRA_ROW_HEIGHT
-
Will set
\extrarowheight
in the floating environment. Requires thearray
LaTeX package. STUB_ALIGN
-
Defines how the left-hand column, the stub, is aligned. Default is 'l' (left aligned).
HEADER_CENTERED
-
This controls the alignment of the header columns, excluding the stub when
STUB_ALIGN
is defined. Valid values are 0 (not centered) or 1 (centered). Typically, it is recommended to center headers, but sometimes this does not look right. In this case, (left) align the header manually. RULES_COLOR_GLOBAL
-
If your theme uses the
colortbl
LaTeX package, this command should handle the coloring of the rules. See thecolortbl
documentation.'RULES_COLOR_GLOBAL' => '\setlength\arrayrulewidth{2pt}\arrayrulecolor{blue}' . '\setlength\doublerulesep{2pt}\doublerulesepcolor{yellow}',
BOOKTABS
-
Use the
booktabs
LaTeX package for "Publication quality tables". Instead of\hline
,LaTeX::Table
then uses\toprule
,\midrule
and\bottomrule
. 0 (don't use this package) or 1 (use it).
You can either quickly add themes after initiation of an LaTeX::Table:
$table->set_custom_themes($theme);
Or, you can build a "THEME MODULE" and extend the list of predefined themes.
THEME MODULE
Now, to build a theme that you can easily load, take the "SYNOPSIS" template, change it and then make it accessible in LaTeX::Table
by saving it under the LaTeX::Table::Themes::*
namespace. Alternatively, you can use the search_path() method to add custom paths. See "SYNOPSIS". If your theme looks nice, please contribute it.
SEE ALSO
AUTHOR
Markus Riester <mriester@gmx.de>
LICENSE AND COPYRIGHT
Copyright (c) 2006-2009, Markus Riester <mriester@gmx.de>
.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.