weaveRhtml: function to weave a rev-file to a html-file

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/weaveRhtml.R

Description

weaveRhtml reads a file that is written according to the rules of the noweb system and performs a simple kind of weaving. As a result a html-file is generated.

Usage

1
weaveRhtml(in.file,out.file,replace.umlaute=TRUE)

Arguments

in.file

name of input file

out.file

name of output file; if this argument is missing the extension of the input file is turned to .html

replace.umlaute

if TRUE german umlaute will be replaced by html sequences

Details

General remarks: A noweb file consists of a mixture of text and code chunks. An @ character (in column 1 of a line) indicates the beginning of a text chunk. <<name of code chunk>>= (starting at column 1 of a line) is a header line of a code chunk with a name defined by the text between << and >>=. A code chunk is finished by the beginning of hte next text chunk. Within the code chunk you are allowed to use other code chunks by referencing them by name ( for example by: <<name of code chunk>> ). In this way you can separate a big job in smaller ones.

Rweb speciality: A code chunk with a code chunk name containing "Rweb" as the first four characters will be translated to a text input field and a submit button compute via Rweb. By pressing this button the code of the text field will be sent for evaluation to Rweb http://rweb.stat.umn.edu/Rweb/ and the results appears in a new browser window. This link to Rweb has been inspirited by web pages like http://www.stat.umn.edu/geyer/3011/examp/reg.html written by Charlie Geyer http://www.stat.umn.edu/~charlie.

Technical remarks: To format small pieces of code in text chunks you have to put them in [[...]]-brackets: text text [[code]] text text. One occurence of such a code in a text line is assumed to work always. If an error emerges caused by formatting code in a text chunk simplify the line by splitting it. Sometimes you want to use [[- or even <<-characters in your text. Then it may be necessary to escape them by an @-sign and you have to type in: @<<, @[[ and so on.

weaveRhtml expands the input by adding a simple html-header as well as some links for navigation. Chunk numbers are written in front of the code chunk headers.

Further details: Some LaTeX macros are transformed to improve the html document.

1. weaveRhtml looks for the LaTeX macros \author, \title and \date at the beginning of the input text. If these macros are found their arguments are used to construct a simple html-head.

2. \section{...}, \subsection{...}, \paragraph{...} macros will be extracted to include some section titles, subsection titles, paragraph titles in bold face fonts. Additionally a simple table of contents is generated.

3. Text lines between \begin{center} and \end{center} are centered.

4. Text lines between \begin{quote} and \end{quote} are shifted a little bit to the right.

5. Text lines between \begin{itemize} and \end{itemize} define a listing. The items of such a list have to begin with \item.

6. \emh{xyz} is transformed to <i>xyz</i>xyz will appear italic.

7. \texttt{xyz} is transformed to <code>xyz</code> – this is formated like code.

Value

a html file is generated

Author(s)

Hans Peter Wolf

References

http://www.eecs.harvard.edu/~nr/noweb/intro.html

See Also

weaveR, tangleR

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
## This example cannot be run by examples() but should be work 
## in an interactive R session
  weaveRhtml("testfile.rev","testfile.tex")
  weaveR("testfile.rev")

## End(Not run)
## The function is currently defined as
weaveRhtml<-function(in.file,out.file){
  # german documentation of the code:
  # look for file webR.pdf, P. Wolf 060910
  ...
}

relax documentation built on May 30, 2017, 6:30 a.m.

Related to weaveRhtml in relax...