pub struct TexRender { /* private fields */ }
Expand description
LaTeX-rendering command.
Creating a new rendering command usually starts by supplying a LaTeX-document, either via
from_bytes
or from_file
. Other options can be set through the various builder methods.
Once satisfied, the render
method will perform the call to the external TeX-engine and return
a rendered PDF as raw bytes.
§TEXINPUTS
The search path for classes, includes or other files used in TeX can be extended using the
TEXINPUTS
environment variable; TexRender
sets this variable when rendering. See
add_texinput
for details.
§Assets
Instead of adding a folder to TEXINPUTS
, any sort of external file can be added as an asset.
Assets are stored in a temporary folder that lives as long as the TexRender
instance, the
folder will automatically be added to TEXINPUTS
when rendering. See the add_asset_*
functions for details.
Implementations§
Source§impl TexRender
impl TexRender
Sourcepub fn from_bytes(source: Vec<u8>) -> TexRender
pub fn from_bytes(source: Vec<u8>) -> TexRender
Create a new tex render configuration using raw input bytes as the source file.
Sourcepub fn from_file<P: AsRef<Path>>(source: P) -> Result<TexRender>
pub fn from_file<P: AsRef<Path>>(source: P) -> Result<TexRender>
Create a new tex render configuration from an input latex file.
Sourcepub fn add_asset_from_bytes<S: AsRef<OsStr>>(
&mut self,
filename: S,
bytes: &[u8],
) -> Result<()>
pub fn add_asset_from_bytes<S: AsRef<OsStr>>( &mut self, filename: S, bytes: &[u8], ) -> Result<()>
Adds an asset to the texrender.
Sourcepub fn add_asset_from_file<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
pub fn add_asset_from_file<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Adds an assets to the texrender from a file.
§Panics
Panics if the passed-in path has no proper filename.
Sourcepub fn add_texinput<P: Into<PathBuf>>(&mut self, input_path: P) -> &mut Self
pub fn add_texinput<P: Into<PathBuf>>(&mut self, input_path: P) -> &mut Self
Adds a path to list of texinputs.
Sourcepub fn latex_mk_path<P: Into<PathBuf>>(&mut self, latex_mk_path: P) -> &mut Self
pub fn latex_mk_path<P: Into<PathBuf>>(&mut self, latex_mk_path: P) -> &mut Self
Sets the path of latexmk
.
If not set, will look for latexmk
on the current PATH
.