R/prohibit_figure_placement.R

Defines functions prohibit_figure_placement

prohibit_figure_placement <- function(filename, .report_error){
  if (missing(.report_error)){
    .report_error <- function(...) report2console(...)
  }
  lines <- read_lines(filename)
  
  if (any(grepl("\\begin{figure}[", lines, fixed = TRUE))){
    line_no <- grep("\\begin{figure}[", lines, fixed = TRUE)
    context <- lines[[line_no]]
    .report_error(line_no = line_no,
                  context = context,
                  error_message = "Manual placement of figures is not permitted.")
    stop("Modification of figure float parameters is not permitted. (Only movement.)")
  }
}

Try the TeXCheckR package in your browser

Any scripts or data that you put into this service are public.

TeXCheckR documentation built on Nov. 17, 2020, 9:08 a.m.