From 340edcc83acbe34be9131bb6d82b4df71f5277e3 Mon Sep 17 00:00:00 2001 From: aartoni Date: Wed, 24 Jul 2024 16:50:51 +0200 Subject: [PATCH] latexmk --- .config/latexmk/latexmkrc | 10 ++++++++++ .config/nvim/init.vim | 2 +- .local/bin/compiler | 14 +------------- .local/bin/texclear | 9 --------- 4 files changed, 12 insertions(+), 23 deletions(-) create mode 100644 .config/latexmk/latexmkrc delete mode 100755 .local/bin/texclear diff --git a/.config/latexmk/latexmkrc b/.config/latexmk/latexmkrc new file mode 100644 index 00000000..b658c5f8 --- /dev/null +++ b/.config/latexmk/latexmkrc @@ -0,0 +1,10 @@ +$bibtex_use = 1.5; +$cleanup_includes_cusdep_generated = 1; +$cleanup_includes_generated = 1; +$out_dir = "out"; +$pdf_mode = 5; +$silent = 1; + +# SyncTeX +push(@generated_exts, ("synctex.*")); +push(@extra_xelatex_options, '-synctex=1') ; diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 61deed66..6cf6a3ac 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -91,7 +91,7 @@ colorscheme vim map p :!opout "%:p" " Runs a script that cleans out tex build files whenever I close out of a .tex file. - autocmd VimLeave *.tex !texclear % + autocmd VimLeave *.tex !latexmk -c % " Ensure files are read as what I want: let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'} diff --git a/.local/bin/compiler b/.local/bin/compiler index 57135906..7497ad29 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -6,9 +6,6 @@ # Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent # presentations. Runs scripts based on extension or shebang. -# Note that .tex files which you wish to compile with XeLaTeX should have the -# string "xelatex" somewhere in a comment/command in the first 5 lines. - file="${1}" ext="${file##*.}" dir=${file%/*} @@ -38,15 +35,6 @@ case "${ext}" in sass) sassc -a "${file}" "${base}.css" ;; scad) openscad -o "${base}.stl" "${file}" ;; sent) setsid -f sent "${file}" 2> "/dev/null" ;; - tex) - textarget="$(getcomproot "${file}" || echo "${file}")" - command="pdflatex" - head -n5 "${textarget}" | grep -qi "xelatex" && command="xelatex" - ${command} --output-directory="${textarget%/*}" "${textarget%.*}" && - grep -qi addbibresource "${textarget}" && - biber --input-directory "${textarget%/*}" "${textarget%.*}" && - ${command} --output-directory="${textarget%/*}" "${textarget%.*}" && - ${command} --output-directory="${textarget%/*}" "${textarget%.*}" - ;; + tex) latexmk ;; *) sed -n '/^#!/s/^#!//p; q' "${file}" | xargs -r -I % "${file}" ;; esac diff --git a/.local/bin/texclear b/.local/bin/texclear deleted file mode 100755 index 6ad3c12e..00000000 --- a/.local/bin/texclear +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Clears the build files of a LaTeX/XeLaTeX build. -# I have vim run this file whenever I exit a .tex file. - -[ "${1##*.}" = "tex" ] && { - find "$(dirname "${1}")" -regex '.*\(_minted.*\|.*\.\(4tc\|xref\|tmp\|pyc\|pyg\|pyo\|fls\|vrb\|fdb_latexmk\|bak\|swp\|aux\|log\|synctex\(busy\)\|lof\|lot\|maf\|idx\|mtc\|mtc0\|nav\|out\|snm\|toc\|bcf\|run\.xml\|synctex\.gz\|blg\|bbl\)\)' -delete -} || printf "Provide a .tex file.\n" -