write_tex: Write a TeX File

View source: R/write_tex.R

write_texR Documentation

Write a TeX File

Description

This function writes a character vector to a .tex file. It ensures the specified path has a .tex extension, checks for directory existence, and allows for overwriting existing files with user feedback.

Usage

write_tex(x, path, verbose = TRUE)

Arguments

x

A character vector to write to the file.

path

A character string specifying the file path. Should be a valid path for a .tex file.

verbose

A logical value indicating whether to print messages and warnings. Default is TRUE.

Value

The function returns the input character vector invisibly.

Examples

## Not run: 
# Write a simple LaTeX document
write_tex(c("\\documentclass{article}", "\\begin{document}", "Hello, world!", "\\end{document}"),
           "output/document.tex")

## End(Not run)

AndreSjuve/texaid documentation built on Oct. 20, 2024, 6:17 a.m.