RPGM 2.0 Docs

Report (.prep file)

An important feature of RPGM is the ability to automatically generate PDF reports according to R results.
The report is generated with MiKTeX. Make sure to have installed it and that RPGM correctly points to it in the option screen, as explained in the installation.html page.

A report is composed by several elements, each element represents something in the report, like a text, an image, a table or a title.

The Report Editor is separated in three parts:

  • Properties which defines the filename, the language and other metadata/properties of the report.
  • Title page for the first page of the report.
  • Elements list for the list of the elements in the report.

The tabs on the top of the Report Editor switch between those parts.

Report properties

The report has several properties:

Report properties

  • Filename will be the final filename of the report, which will be copied in the output folder of the user. It can be a R expression. If the filename is a relative path (report/R1.pdf), this will be relative to the final user output subfolder.
  • Template has two options: Standard properties and Custom properties. Standard properties is the one in the picture above, Custom properties is for advanced LaTeX users as the header must be completely write from scratch and will be insert before \begin{document}.

The Standard properties contains several properties which are straightforward:

  • Language is the language of the document. It appears when LaTeX makes titles. For a table, Table 1 will be displayed in English whereas Tableau 1 will be displayed in French.
  • Title, Author, and Date. All those are optional and can be either a R expression or static values.
  • Custom \usepackage or custom LaTeX commands adds some LaTeX code at the end of the header, before the document. It is also reserved for advanced LaTeX users.
  • Font size / V Offset / Side margin / Text height and Text width determine the margins and the visual aspect of the report. All those values are in points (pt).

Generally, you will want to use the same properties for all reports, do not hesitate to copy an old .prep file in your new project to keep the properties.

Title page

The Title page is the first page of the document.

Report title

Choose a template for the title page. The Example button will open an empty document to see what the template looks like. There is three templates:

  • LaTeX default is the default \maketitle page of LaTeX, which uses the properties of the LaTeX document.
  • Title page with two images is a premade title page in RPGM which you can customize with texts and images. For the images, a relative path will point to the temporary folder containing your project’s files.
  • Custom or no title page removes the title page and leaves the choice to create one (or not) with the Simple Text / LaTeX expression element.

The Generate Table of Contents checkbox will automatically create a Table of Contents according to the document.

Elements

On the left of the screen a list shows all the elements you added to the report:

Report elements

Each line represents an added element. The icon on the left represents the type of the element (Title, Text, Image, Table…). By selecting an element in this list, its properties appears on the right. You can also drag and drop to reorder elements. On the top, an element type can be selected and added to the report with the Add button. A right click on a row of the list will display a context menu for duplicating or removing an element.

Title

Title element

This element makes a title in the document.
Title style is the level of the title. In the order of importance, it is Part, Section, Sub Section, Sub Sub Section, Paragraph and Sub Paragraph. You will likely not use Part, as it is more for books than reports. You can also choose if the title will be numbered and/or in Table of Content (ToC).

The following picture gives the result of each title in the pdf:

Report title level

Simple Text / LaTeX expression

Text element

Simple Text writes a text element in the document. If you want to add a new line, you must end a line with two backslashes \\, as it is how it works in LaTeX. It can contains some LaTeX code. For example, writing A \textbf{bold} word and a $\alpha$ variable will generate this:

LaTeX result

Table

Table element

Will display the given R matrix or table in the report. Table style will determine if there is a horizontal line between each rows or just for the header. First cell text will be used if you made a matrix and named the rows/columns within R, the text will be displayed in the very first cell of the table. Caption will write a text below the table and ID is for making references using LaTeX code, for example: As you can see in the Table \ref{MyTableID}..

Image

Image element

Will display an image. Scale is a factor, 1 will show the native size of the image. Caption and ID are optional. For the paths:

  • If it is not a R expression, a relative path will be from the working directory (think of getwd())
  • If it is a R expression, a relative path will be from the pgmfilepath() function, you must use something like paste(getwd(), "/", img_name, sep="") if you want to display from the output folder.

Equation

Equation element

Will display a mathematic expression. ID is optional, and you can set if the equation will be numbered or not.

New page

Will add a blank space so that the next element start on a new page.

Vertical space

Space element

Add a blank space of the specified centimeters.