Learn R Programming

lazyWeave (version 2.2.0)

lazy.text: Paragraphs in LaTeX

Description

Write paragraphs in LaTeX code.

Usage

lazy.text(..., title=NULL, align="left",
    italic=FALSE, bold=FALSE, underline=FALSE, sep="",
    translate=TRUE, font, family, size)

Arguments

...
Text and other objects to be included in the paragraph.
title
A title for the paragraph
align
alignment of the paragraph. Options are "left", "center", "right".
italic
Logical. Indicates if the text should be italicized.
bold
Logical. Indicates if the text shoudl be bolded.
underline
Logical. Indicates if the text should be underlined.
sep
Character. Denotes the separation string for the items in ... when they are pasted together.
translate
Toggles if inputs in x should be passed through latexTranslate. This should be set to FALSE if writing custom code.
font
HTML font for the paragraph. Defaults to the HTML option (see setHtmlOptions).
family
HTML font family for the paragraph. Defaults to the HTML option (see setHtmlOptions).
size
Text size of the paragraph. Defaults to the HTML option (see setHtmlOptions). May be an integer or a LaTeX size descriptor. See "Details" for options.

Details

Options for text size are ll{ tiny smallest scriptsize footnotesize small normalsize large Large LARGE huge Huge BIGGEST } When size is denoted as an integer, as necessary for HTML, it is mapped to a LaTeX size using map.size. Likewise, the LaTeX descriptors can be mapped to integers using map.size. Additional formatting may be applied using commands such as textbf{} for bold text, emph{} for italics, and ul{} for underlined text (assuming the soul package is available), but doing so is probably easier using lazy.text.format.

Examples

Run this code
lazy.write(
  lazy.file.start(),
  lazy.text("Typically we want our paragraphs to be left 
    justified.  This is often what we expect to see when reading."),
  lazy.text("However, we may also have occasions where we would 
    like to center our text.  It's one of many ways we can make the 
    words stand out on the page", align="center"),
  lazy.text("A more traditional way to make the text stand out might be
    to use bold text or italics, such as these", bold=TRUE, italic=TRUE),
  lazy.file.end(),
  OutFile="Example 1.tex")
  
unlink("Example 1.tex")

Run the code above in your browser using DataLab