From 7cb8c4bc2896bf2acbd8c662b3f6bda4b1c5b3fe Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Tue, 31 Jan 2023 08:13:12 +1030 Subject: [PATCH] added compiler related script from voidrice --- scripts/getcomproot | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 scripts/getcomproot diff --git a/scripts/getcomproot b/scripts/getcomproot new file mode 100755 index 0000000..d34a2e4 --- /dev/null +++ b/scripts/getcomproot @@ -0,0 +1,12 @@ +#!/bin/bash + +# A helper script for LaTeX/groff files used by `compiler` and `opout`. +# The user can add the root file of a larger project as a comment as below: +# % root = mainfile.tex +# And the compiler script will run on that instead of the opened file. + +texroot="$(grep -i "^.\+\s*root\s*=\s*\S\+" "$1")" +texroot="${texroot##*=}" +texroot="${texroot//[\"\' ]}" + +[ -f "$texroot" ] && readlink -f "$texroot" || exit 1