checkingBookSources         package:RbcBook1         R Documentation

_F_o_r_m_a_t_t_i_n_g _a_n_d _s_t_a_n_d_a_r_d_i_z_a_t_i_o_n _c_h_e_c_k_s _o_n _b_o_o_k _c_h_a_p_t_e_r_s

_D_e_s_c_r_i_p_t_i_o_n:

     Formatting and standardization checks on book chapters

_U_s_a_g_e:

     checkVerbatim(files = .RbcBook1Files(ext=".tex"),
                    maxc = 70,
                   which = "both",
                 verbose = TRUE)

     checkRnw(files = .RbcBook1Files(),
            verbose = TRUE, stopOnError=FALSE)

     checkPackage(files = .RbcBook1Files(ext=".Rnw"),
                verbose = TRUE)

     .RbcBook1Files(ext=".Rnw")

_A_r_g_u_m_e_n_t_s:

   files: character vector with names (and path) of chapter source
          files

     ext: character of length 1. File name extension. '.Rnw' (the
          default) and '.tex' should be the most important cases.

    maxc: integer of length 1. Maximal number of characters in a
          verbatim line. All lines exceeding this limit will be
          reported in the return value of this function.

   which: character of length 1. 'Sinput' will look at 'Sinput'
          environments, 'Soutput' at 'Soutput' environments, 'both' at
          both.

 verbose: Logical.

stopOnError: Logical. If FALSE, first error found will lead to stop. If
          TRUE, try to continue checking.

_D_e_t_a_i_l_s:

     'checkVerbatimLines' sees whether all verbatim lines have length
     at most 'maxc'.

     'checkPackage' finds all the occurences of \Rpackage{...} in the
     text, checks whether the package is known, and returns a named
     list will all occurences of the packages.

_V_a_l_u_e:

     For 'checkVerbatimLines' and 'checkSetup', a data frame with one
     row for each offending line and various columns describing it.

     For '.RbcBook1Files', a character vector.

_A_u_t_h_o_r(_s):

     Wolfgang Huber <huber@ebi.ac.uk>

_E_x_a_m_p_l_e_s:

       f = tempfile()
       zap = function(n) paste(formatC(1:n, width=2), collapse=" ")
       writeLines(c("*begin{Sinput}", zap(20), zap(30), "*end{Sinput}"), con=f)
       checkVerbatim(files=f)

