| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Dynare provides a simple interface for creating LaTeX reports, comprised of LaTeX tables and TikZ graphs. You can use the report as created through Dynare or pick out the pieces you want for inclusion in your own paper.
Reports are created and modified by calling methods on class
objects. The objects are hierarchical, with the following order (from
highest to lowest): Report, Page, Section, Graph/Table/Vspace,
Series. For simplicity of syntax, we abstract away from these
classes, allowing you to operate directly on a Report object,
while maintaining the names of these classes in the Report
Class methods you will use.
The report is created sequentially, command by command, hence the
order of the commands matters. When an object of a certain hierarchy
is inserted, all methods will function on that object until an object
of equal or greater hierarchy is added. Hence, once you add a
Page to the report, every time you add a Section object,
it will be added to this Page until another Page is
added to the report (via addPage). This will become more clear
with the example at the end of the section.
Options to the methods are passed differently than those to Dynare
commands. They take the form of named options to Matlab functions
where the arguments come in pairs (e.g.
function_name('option_1_name', `option_1_value',
'option_2_name', 'option_2_value', ...), where option_X_name
is the name of the option while option_X_value is the value
assigned to that option). The ordering of the option pairs matters
only in the unusual case when an option is provided twice (probably
erroneously). In this case, the last value passed is the one that is
used.
Below, you will see a list of methods available for the Report class and a clarifying example.
Instantiates a Report object.
Options
compiler, FILENAMEThe full path to the LaTeX compiler on your system. If this option
is not provided, Dynare will try to find the appropriate program to
compile LaTeX on your system. Default is system dependent: Windows:
the result of findtexmf --file-type=exe pdflatex, Mac OS X and
Linux: the result of which pdflatex
showDate, BOOLEANDisplay the date and time when the report was compiled. Default:
true
filename, FILENAMEThe filename to use when saving this report. Default:
report.tex
margin, DOUBLEThe margin size. Default: 2.5
marginUnit, `cm' | `in'Units associated with the margin. Default: `cm'
orientation, `landscape' | `portrait'Paper orientation: Default: `portrait'
paper, `a4' | `letter'Paper size. Default: `a4'
title, STRINGReport Title. Default: none
Adds a Page to the Report.
Options
footnote, STRINGA footnote to be included at the bottom of this page. Default: none
orientation, `landscape' | `portrait'See orientation.
paper, `a4' | `letter'See paper.
title, STRING | CELL_ARRAY_STRINGSWith one entry (a STRING), the title of the page. With more
than one entry (a CELL_ARRAY_STRINGS), the title and subtitle(s)
of the page. Default: none
titleFormat, STRING | CELL_ARRAY_STRINGSA string representing the LaTeX markup to use on the
title. The number of cell array entries must be equal to that of
the title option. Default: none
Adds a Section to a Page.
Options
cols, INTEGERThe number of columns in the section. Default: 1
height, STRINGA string to be used with the \sectionheight LaTeX
command. Default: `!'
Adds a Graph to a Section.
Options
data, dseriesThe dseries that provides the data for the graph. Default:
none
figname, STRINGThe name to use when saving this figure. Default: [tempname
`.tex']
figDirName, STRINGThe name of the folder in which to store this figure. Default:
tmpFigDir
graphSize, NUMERICAL_VECTORThe width and height to be passed to the third and fourth elements of
the array passed to the `Position' option of Matlab’s
figure command, passed as a vector of size
. Default:
Matlab sets width and height
showGrid, BOOLEANWhether or not to display the minor grid on the graph. Default:
true
showLegend, BOOLEANWhether or not to display the legend. Default: false
showLegendBox, BOOLEANWhether or not to display a box around the legend. Default:
false
legendLocation, `North' | `South' | `East' | `West' | `NorthEast' | `SouthEast' | `NorthWest' | `SouthWest' | `NorthOutside' | `SouthOutside' | `EastOutside' | `WestOutside' | `NorthEastOutside' | `SouthEastOutside' | `NorthWestOutside' | `SouthWestOutside' | `Best' | `BestOutside'Where to place the legend in the graph. NB: some of these are not
available under Octave. Default: `SouthEast'
legendOrientation, `vertical' | `horizontal'Orientation of the legend. Default: `horizontal'
legendFontSize, DOUBLEThe font size for legend entries. Default: 8
seriesToUse, CELL_ARRAY_STRINGSThe names of the series contained in the dseries provided to
the data option. If empty, use all series provided to
data option. Default: empty
shade, datesThe date range showing the portion of the graph that should be
shaded. Default: none
shadeColor, MATLAB_COLOR_NAMEThe color to use in the shaded portion of the graph. Default:
`green'
shadeOpacity, DOUBLEThe opacity of the shaded area, must be in
. Default: .2
title, STRINGTitle for the graph. Default: none
xlabel, STRINGThe x-axis label. Default: none
ylabel, STRINGThe y-axis label. Default: none
xrange, datesThe boundary on the x-axis to display in the graph. Default: all
xTicks, NUMERICAL_VECTORUsed only in conjunction with xTickLabels, this option denotes
the numerical position of the label along the x-axis. The positions
begin at
. Default: set by Matlab/Octave.
xTickLabels, CELL_ARRAY_STRINGSThe labels to be mapped to the ticks provided by
xTicks. Default: the dates of the dseries
yrange, NUMERICAL_VECTORThe boundary on the y-axis to display in the graph, represented as a
NUMERICAL_VECTOR of size
, with the first entry less
than the second entry. Default: all
showZeroline, BOOLEANDisplay a solid black line at
. Default: false
Adds a Table to a Section.
Options
data, dseriesSee data.
showHlines, BOOLEANWhether or not to show horizontal lines separating the rows. Default: false
precision, INTEGERThe number of decimal places to report in the table data. Default: 1
range, datesThe date range of the data to be displayed. Default: all
seriesToUse, CELL_ARRAY_STRINGSSee seriesToUse.
title, STRINGTitle for the table. Default: none
titleSize, STRINGLaTeX string representing the size of the table title. Default: large
vlineAfter, dates | CELL_ARRAY_DATESShow a vertical line after the specified date (or dates if a cell
array of dates is passed). Default: empty
vlineAfterEndOfPeriod, BOOLEANShow a vertical line after the end of every period (i.e. after
every year, after the fourth quarter, etc.). Default: false
showVlines, BOOLEANWhether or not to show vertical lines separating the columns. Default: false
Adds a Series to a Graph or a Table.
Options
data, dseriesSee data.
graphLineColor, MATLAB_COLORColor to use for the series in a graph. Default: `k'
graphLineStyle, `none' | `-' | `--' | `:' | `-.'Line style for this series in a graph. Default: '-'
graphLineWidth DOUBLELine width for this series in a graph. Default: 0.5
graphMarker, `+' | `o' | `*' | `.' | `x' | `s' | `square' | `d' | `diamond' | `^' | `v' | `>' | `<' | `p' | `pentagram' | `h' | `hexagram' | `none'The Marker to use on this series in a graph. Default: none
graphMarkerEdgeColor, MATLAB_COLORThe edge color of the graph marker. Default: `auto'
graphMarkerFaceColor, MATLAB_COLORThe face color of the graph marker. Default: `auto'
graphMarkerSize, DOUBLEThe size of the graph marker. Default: 6
tableDataRhs, dseriesA series to be added to the right of the current series. Usefull for
displaying aggregate data for a series. e.g if the series is
quarterly tableDataRhs could point to the yearly averages of
the quarterly series. This would cause quarterly data to be displayed
followed by annual data. Default: empty
tableRowColor, STRINGThe color that you want the row to be. Predefined values include
LightCyan and Gray. Default: white.
tableShowMarkers, BOOLEANIn a Table, if true, surround each cell with brackets and color
it according to tableNegColor and tablePosColor. No effect
for graphs. Default: false
tableAlignRight, BOOLEANWhether or not to align the series name to the right of the
cell. Default: false
tableMarkerLimit, DOUBLEFor values less than
, mark the cell
with the color denoted by tableNegColor. For those greater than
tableMarkerLimit, mark the cell with the color denoted by
tablePosColor. Default: 1e-4
tableNegColor, LATEX_COLORThe color to use when marking Table data that is less than
zero. Default: `red'
tablePosColor, LATEX_COLORThe color to use when marking Table data that is greater than
zero. Default: `blue'
tableSubSectionHeader, STRINGA header for a subsection of the table. No data will be associated
with it. It is equivalent to adding an empty series with a
name. Default: ''
zerotol, DOUBLEThe zero tolerance. Anything smaller than zerotol and larger
than -zerotol will be set to zero before being
graphed. Default:
Adds a Vspace (vertical space) to a Section.
Options
hline, INTEGERThe number of horizontal lines to be inserted. Default: 0
number, INTEGERThe number of new lines to be inserted. Default: 1
Writes the LaTeX representation of this Report, saving it to
the file specified by filename.
Compiles the report written by write into a pdf file. If
the report has not already been written (determined by the existence
of the file specified by filename, write is called.
optionshead
compiler, FILENAMELike compiler, except will not overwrite the value of
compiler contained in the report object. Hence, passing the
value here is useful for using different LaTeX compilers or just
for passing the value at the last minute.
Example
The following code creates a one page report. The first part of the page contains two graphs displayed across two columns and one row. The bottom of the page displays a centered table.
%% Create dseries
dsq = dseries(`quarterly.csv');
dsa = dseries(`annual.csv');
dsca = dseries(`annual_control.csv');
%% Report
rep = report();
%% Page 1
rep = rep.addPage(`title', `My Page Title', `titleFormat', `\large\bfseries');
% Section 1
rep = rep.addSection(`cols', 2);
rep = rep.addGraph(`title', `Graph (1,1)', `showLegend', true, ...
`xrange', dates(`2007q1'):dates(`2013q4'), ...
`shade', dates(`2012q2'):dates(`2013q4'));
rep = rep.addSeries(`data', dsq{`SERIES1'}, `color', `b', ...
`graphLineWidth', 1);
rep = rep.addSeries(`data', dsq{`SERIES2'}, `color', `g', ...
`graphLineStyle', '--', `graphLineWidth', 1.5);
rep = rep.addGraph(`title', `Graph (1,2)', `showLegend', true, ...
`xrange', dates(`2007q1'):dates(`2013q4'), ...
`shade', dates(`2012q2'):dates(`2013q4'));
rep = rep.addSeries(`data', dsq{`SERIES3'}, `color', `b', ...
`graphLineWidth', 1);
rep = rep.addSeries(`data', dsq{`SERIES4'}, `color', `g', ...
`graphLineStyle', '--', `graphLineWidth', 1.5);
% Section 2
rep = rep.addSection();
rep = rep.addTable(`title', `Table 1', ...
`range', dates(`2012Y'):dates(`2014Y'));
shortNames = {`US', `EU'};
longNames = {`United States', `Euro Area'};
for i=1:length(shortNames)
rep = rep.addSeries(`data', dsa{[`GDP_' shortNames{i}]});
delta = dsa{[`GDP_' shortNames{i}]}-dsca{[`GDP_' shortNames{i}]};
delta = delta.tex_rename(`$\Delta$');
rep = rep.addSeries(`data', delta, ...
`tableShowMarkers', true, ...
`tableAlignRight', true);
end
%% Write & Compile Report
rep.write();
rep.compile();
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by Build Daemon user on December 8, 2015 using texi2html 1.82.