Skip to content

Commit

Permalink
Use latexmk instead of pdflatex directly (closes #56)
Browse files Browse the repository at this point in the history
This means that references and other parts of LaTeX that need multiple
runs will now work correctly.
  • Loading branch information
Samasaur1 committed Feb 11, 2024
1 parent e000eb5 commit 3d33988
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ pub(crate) async fn delete_file(obj: IdOnly, repos: Arc<Mutex<HashMap<Uuid, Repo
/*
// PREVIEW FILE //
pdflatex -output-directory {} {}, this_commit_path, input_file_path
latexmk -pdf -output-directory=dest/ -interaction=nonstopmode -halt-on-error source/file.tex
TODO: Comment preview_file() functionality & general description
TODO: do
Expand Down Expand Up @@ -387,9 +388,11 @@ pub(crate) async fn preview_file(obj: FileIDAndGitHash, repos: Arc<Mutex<HashMap
let output_name = format!("{name_root}.pdf");
log::trace!(target: "remote_text_server::preview_file", "[{}] Output name: {}", &obj.id, output_name);

let res = Command::new("pdflatex")
.args(["-output-directory", this_commit_path.canonicalize().unwrap().to_str().unwrap()])
.args(["-interaction", "nonstopmode"])
// latexmk -pdf -output-directory=dest/ -interaction=nonstopmode -halt-on-error source/file.tex
let res = Command::new("latexmk")
.arg("-pdf")
.arg(format!("-output-directory={}", &this_commit_path.canonicalize().unwrap().to_str().unwrap()))
.arg("-interaction=nonstopmode")
.arg("-halt-on-error")
.arg(format!("./files/{}/{filename}", &obj.id))
.stdout(Stdio::null())
Expand Down

0 comments on commit 3d33988

Please sign in to comment.