Add 'lualatex' compiler support.
Add 'lualatex' compiler support (as in #6 pull request) and minor code modifications.
This commit is contained in:
parent
07100aa7bb
commit
c883810608
|
@ -1,6 +1,6 @@
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2007-2016 Michal Kalewski <mkalewski at cs.put.poznan.pl>
|
Copyright (c) 2007-2017 Michal Kalewski <mkalewski at cs.put.poznan.pl>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
34
README.rst
34
README.rst
|
@ -3,7 +3,7 @@ pdflatex.sh
|
||||||
===========
|
===========
|
||||||
|
|
||||||
:Author: Michał Kalewski
|
:Author: Michał Kalewski
|
||||||
:Version: 3.4.0
|
:Version: 3.5.0
|
||||||
:License: MIT License
|
:License: MIT License
|
||||||
:Bug reports: https://github.com/mkalewski/pdflatex.sh/issues
|
:Bug reports: https://github.com/mkalewski/pdflatex.sh/issues
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ Synopsis
|
||||||
|
|
||||||
Description
|
Description
|
||||||
===========
|
===========
|
||||||
A bash script to simplify TeX, LaTeX, and XeLaTeX files compilation with
|
A bash script to simplify TeX, LaTeX, XeLaTeX, and LuaLaTeX files compilation
|
||||||
bibliographies (BibTeX), glossaries (MakeGlossaries), indices (MakeIndex),
|
with bibliographies (BibTeX), glossaries (MakeGlossaries), indices (MakeIndex),
|
||||||
PSTricks, and more. In the simplest case, the script is run as follows::
|
PSTricks, and more. In the simplest case, the script is run as follows::
|
||||||
|
|
||||||
$ pdflatex.sh file.tex
|
$ pdflatex.sh file.tex
|
||||||
|
@ -33,7 +33,7 @@ compilation.
|
||||||
|
|
||||||
The ``pdflatex.sh`` script can also be used to convert images to the PDF format
|
The ``pdflatex.sh`` script can also be used to convert images to the PDF format
|
||||||
and to manipulate output PDF documents. The script also lets you check
|
and to manipulate output PDF documents. The script also lets you check
|
||||||
syntactic and semantic correctness of (La)TeX source files, e.g. with the use
|
syntactic and semantic correctness of (La)TeX source files, e.g., with the use
|
||||||
of *ChkTeX*, and create handouts from beamer slides (for more information see
|
of *ChkTeX*, and create handouts from beamer slides (for more information see
|
||||||
options_ and examples_).
|
options_ and examples_).
|
||||||
|
|
||||||
|
@ -45,16 +45,14 @@ Note
|
||||||
|
|
||||||
If the script is run as `pdflatex.sh`, then the `pdflatex` command is used
|
If the script is run as `pdflatex.sh`, then the `pdflatex` command is used
|
||||||
(producing PDF output files). However, if the script is run as `latex.sh`,
|
(producing PDF output files). However, if the script is run as `latex.sh`,
|
||||||
then the `latex` command is used (producing DVI output files), and if the
|
then the `latex` command is used (producing DVI output files). Moreover, if
|
||||||
script is run as `xelatex.sh`, then the `xelatex` command is used (producing
|
the script is run as `xelatex.sh` or `lualatex.sh`, then the `xelatex` or
|
||||||
PDF output files). Thus, if necessary, symbolic links may be created to use
|
`lualatex` command is used respectively (producing PDF output files). Thus, if
|
||||||
the script easily, e.g.::
|
necessary, symbolic links may be created to use the script easily, e.g.::
|
||||||
|
|
||||||
$ ln -s ./pdflatex.sh ./latex.sh
|
$ ln -s ./pdflatex.sh ./latex.sh
|
||||||
$ ln -s ./pdflatex.sh ./xelatex.sh
|
$ ln -s ./pdflatex.sh ./xelatex.sh
|
||||||
|
$ ln -s ./pdflatex.sh ./lualatex.sh
|
||||||
**Arch Linux** users may use `tdi <https://github.com/tdi>`_'s `AUR package
|
|
||||||
<http://aur.archlinux.org/packages.php?ID=55739>`_ to obtain the script.
|
|
||||||
|
|
||||||
**OS X** users need to install GNU grep, i.e., ``ggrep``, which is required for
|
**OS X** users need to install GNU grep, i.e., ``ggrep``, which is required for
|
||||||
the script to work correctly.
|
the script to work correctly.
|
||||||
|
@ -68,7 +66,8 @@ Options
|
||||||
Put four pages of the PDF FILE on a single A4 sheet (the output will be in a
|
Put four pages of the PDF FILE on a single A4 sheet (the output will be in a
|
||||||
FILE-nup.pdf file).
|
FILE-nup.pdf file).
|
||||||
``+3``
|
``+3``
|
||||||
Run ``latex``/``pdflatex``/``xelatex`` thrice (default is twice).
|
Run ``latex``/``pdflatex``/``xelatex``/``lualatex`` thrice (default is
|
||||||
|
twice).
|
||||||
``-b FILE``
|
``-b FILE``
|
||||||
Make ONLY BibTeX.
|
Make ONLY BibTeX.
|
||||||
``+b``
|
``+b``
|
||||||
|
@ -110,8 +109,8 @@ Options
|
||||||
``+o``
|
``+o``
|
||||||
Open the resulting PDF (or DVI) file after the compilation.
|
Open the resulting PDF (or DVI) file after the compilation.
|
||||||
``+p``
|
``+p``
|
||||||
Use ``ps4pdf`` instead of ``latex``/``pdflatex``/``xelatex`` (the
|
Use ``ps4pdf`` instead of ``latex``/``pdflatex``/``xelatex``/``lualatex``
|
||||||
`"PSTricks" <https://www.ctan.org/pkg/pstricks-base>`_ package).
|
(the `"PSTricks" <https://www.ctan.org/pkg/pstricks-base>`_ package).
|
||||||
``-s FILE``
|
``-s FILE``
|
||||||
Check sentence separators.
|
Check sentence separators.
|
||||||
``+s``
|
``+s``
|
||||||
|
@ -120,8 +119,9 @@ Options
|
||||||
Start the interactive ``aspell`` spell checker (by default ``LANG="en_GB"``
|
Start the interactive ``aspell`` spell checker (by default ``LANG="en_GB"``
|
||||||
and UTF-8 encoding is used).
|
and UTF-8 encoding is used).
|
||||||
``+shell``
|
``+shell``
|
||||||
Enable the shell escape option of ``latex``/``pdflatex``/``xelatex`` (e.g.,
|
Enable the shell escape option of
|
||||||
for the `"minted" <https://www.ctan.org/pkg/minted>`_ package).
|
``latex``/``pdflatex``/``xelatex``/``lualatex`` (e.g., for the `"minted"
|
||||||
|
<https://www.ctan.org/pkg/minted>`_ package).
|
||||||
``-ss FILE``
|
``-ss FILE``
|
||||||
STRICTLY check sentence separators.
|
STRICTLY check sentence separators.
|
||||||
``+sync``
|
``+sync``
|
||||||
|
@ -174,7 +174,7 @@ Examples
|
||||||
|
|
||||||
Copyright
|
Copyright
|
||||||
=========
|
=========
|
||||||
| (c) 2007-2016 Michal Kalewski <mkalewski at cs.put.poznan.pl>
|
| (c) 2007-2017 Michal Kalewski <mkalewski at cs.put.poznan.pl>
|
||||||
|
|
|
|
||||||
| This program comes with ABSOLUTELY NO WARRANTY.
|
| This program comes with ABSOLUTELY NO WARRANTY.
|
||||||
| THIS IS FREE SOFTWARE, AND YOU ARE WELCOME TO REDISTRIBUTE IT UNDER THE TERMS
|
| THIS IS FREE SOFTWARE, AND YOU ARE WELCOME TO REDISTRIBUTE IT UNDER THE TERMS
|
||||||
|
|
56
pdflatex.sh
56
pdflatex.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# UTF-8
|
# UTF-8
|
||||||
|
|
||||||
# (c) 2007-2016 Michal Kalewski <mkalewski at cs.put.poznan.pl>
|
# (c) 2007-2017 Michal Kalewski <mkalewski at cs.put.poznan.pl>
|
||||||
#
|
#
|
||||||
# This program comes with ABSOLUTELY NO WARRANTY.
|
# This program comes with ABSOLUTELY NO WARRANTY.
|
||||||
# THIS IS FREE SOFTWARE, AND YOU ARE WELCOME TO REDISTRIBUTE IT UNDER THE
|
# THIS IS FREE SOFTWARE, AND YOU ARE WELCOME TO REDISTRIBUTE IT UNDER THE
|
||||||
|
@ -21,8 +21,8 @@
|
||||||
# | -sc [LANG] FILE(.tex)
|
# | -sc [LANG] FILE(.tex)
|
||||||
#
|
#
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
# A bash script to simplify TeX/LaTeX/XeLaTeX files compilation and more.
|
# A bash script to simplify TeX/LaTeX/XeLaTeX/LuaLaTeX files compilation and
|
||||||
# Just run the script to get more information: './pdflatex.sh'.
|
# more. Just run the script to get more information: './pdflatex.sh'.
|
||||||
#
|
#
|
||||||
# REPORTING BUGS
|
# REPORTING BUGS
|
||||||
# <https://github.com/mkalewski/pdflatex.sh/issues>
|
# <https://github.com/mkalewski/pdflatex.sh/issues>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
# VERSION
|
# VERSION
|
||||||
# =======
|
# =======
|
||||||
VERSION=3.4.0
|
VERSION=3.5.0
|
||||||
|
|
||||||
|
|
||||||
# PROGRAMS
|
# PROGRAMS
|
||||||
|
@ -44,14 +44,14 @@ BIBTEX_PROGRAM="bibtex"
|
||||||
CHKTEX_PROGRAM="chktex"
|
CHKTEX_PROGRAM="chktex"
|
||||||
DETEX_PROGRAM="detex"
|
DETEX_PROGRAM="detex"
|
||||||
DIA_PROGRAM="dia"
|
DIA_PROGRAM="dia"
|
||||||
#EPSTOPDF_PROGRAM="epstopdf" # obsolete
|
|
||||||
INKSCAPE_PROGRAM="inkscape"
|
INKSCAPE_PROGRAM="inkscape"
|
||||||
LATEX_PROGRAM="latex"
|
LATEX_PROGRAM="latex"
|
||||||
MAKEINDEX_PROGRAM="makeindex"
|
LUALATEX_PROGRAM="lualatex"
|
||||||
MAKEGLOSSARIES_PROGRAM="makeglossaries"
|
MAKEGLOSSARIES_PROGRAM="makeglossaries"
|
||||||
PDF_VIEWER_PROGRAM="evince"
|
MAKEINDEX_PROGRAM="makeindex"
|
||||||
PDFLATEX_PROGRAM="pdflatex"
|
PDFLATEX_PROGRAM="pdflatex"
|
||||||
PDFNUP_PROGRAM="pdfnup"
|
PDFNUP_PROGRAM="pdfnup"
|
||||||
|
PDF_VIEWER_PROGRAM="evince"
|
||||||
PS4PDF_PROGRAM="ps4pdf"
|
PS4PDF_PROGRAM="ps4pdf"
|
||||||
XELATEX_PROGRAM="xelatex"
|
XELATEX_PROGRAM="xelatex"
|
||||||
|
|
||||||
|
@ -62,12 +62,13 @@ ASPELL_ENC_OPT="--encoding=utf-8"
|
||||||
ASPELL_LANG_OPT="-l en_GB"
|
ASPELL_LANG_OPT="-l en_GB"
|
||||||
CHKTEX_OPT="-q -v1"
|
CHKTEX_OPT="-q -v1"
|
||||||
GREP_COLOR="--color=auto"
|
GREP_COLOR="--color=auto"
|
||||||
|
INKSCAPE_OPT="" # ="-T" # converts text objects to paths on export
|
||||||
LATEX_BATCHMODE_OPT="-interaction batchmode"
|
LATEX_BATCHMODE_OPT="-interaction batchmode"
|
||||||
LATEX_SHELL_ESCAPE_OPT="-shell-escape"
|
LATEX_SHELL_ESCAPE_OPT="-shell-escape"
|
||||||
|
MAKEGLOSSARIES_OPT="-q"
|
||||||
PDFLATEX_SYNCTEX_OPT="-synctex=1"
|
PDFLATEX_SYNCTEX_OPT="-synctex=1"
|
||||||
PDFNUP_OPT="--paper a4paper --frame true --scale 0.96 --delta \"2mm 2mm\""
|
PDFNUP_OPT="--paper a4paper --frame true --scale 0.96 --delta \"2mm 2mm\""
|
||||||
PS4PDF_LATEX_OPT="\AtBeginDocument{\RequirePackage{pst-pdf}}"
|
PS4PDF_LATEX_OPT="\AtBeginDocument{\RequirePackage{pst-pdf}}"
|
||||||
MAKEGLOSSARIES_OPT="-q"
|
|
||||||
|
|
||||||
|
|
||||||
# FILE TO BUILD
|
# FILE TO BUILD
|
||||||
|
@ -87,7 +88,7 @@ AUXILIARYEXTS_BIBTEX="$AUXILIARYEXTS_COMMON dvi gls ind pdf synctex.gz"
|
||||||
AUXILIARYEXTS_INDEX="$AUXILIARYEXTS_COMMON bbl div gls pdf synctex.gz"
|
AUXILIARYEXTS_INDEX="$AUXILIARYEXTS_COMMON bbl div gls pdf synctex.gz"
|
||||||
AUXILIARYEXTS_GLOSSARIES="$AUXILIARYEXTS_COMMON bbl div ind pdf synctex.gz"
|
AUXILIARYEXTS_GLOSSARIES="$AUXILIARYEXTS_COMMON bbl div ind pdf synctex.gz"
|
||||||
|
|
||||||
# Options to pass to the latex/pdflatex/xelatex compilers:
|
# Options to pass to the latex/pdflatex/xelatex/lualatex compilers:
|
||||||
LATEX_OPTIONS="$LATEX_BATCHMODE_OPT"
|
LATEX_OPTIONS="$LATEX_BATCHMODE_OPT"
|
||||||
|
|
||||||
# Base name of the script:
|
# Base name of the script:
|
||||||
|
@ -128,18 +129,19 @@ set +H
|
||||||
function print_help() {
|
function print_help() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
${txtbld}PDFLATEX.SH${txtrst} $VERSION (c) 2007-2016\
|
${txtbld}PDFLATEX.SH${txtrst} $VERSION (c) 2007-2017\
|
||||||
${txtbld}Michal Kalewski${txtrst} <mkalewski at cs.put.poznan.pl>
|
${txtbld}Michal Kalewski${txtrst} <mkalewski at cs.put.poznan.pl>
|
||||||
|
|
||||||
${txtund}A BASH SCRIPT TO SIMPLIFY TeX/LaTeX/XeLaTeX FILES COMPILATION\
|
${txtund}A BASH SCRIPT TO SIMPLIFY TeX/LaTeX/XeLaTeX/LuaLaTeX FILES\
|
||||||
AND MORE${txtrst}
|
COMPILATION AND MORE${txtrst}
|
||||||
|
|
||||||
NOTE: If the script is run as 'pdflatex.sh', then the 'pdflatex' command is
|
NOTE: If the script is run as 'pdflatex.sh', then the 'pdflatex' command is
|
||||||
used (producing PDF output files). However, if the script is run as
|
used (producing PDF output files). However, if the script is run as
|
||||||
'latex.sh', then the 'latex' command is used (producing DVI output
|
'latex.sh', then the 'latex' command is used (producing DVI output
|
||||||
files), and if the script is run as 'xelatex.sh', then the 'xelatex'
|
files). Moreover, if the script is run as 'xelatex.sh' or
|
||||||
command is used (producing PDF output files). Thus, if necessary,
|
'lualatex.sh', then the 'xelatex' or 'lualatex' command is used
|
||||||
symbolic links may be created to use the script easily.
|
respectively (producing PDF output files). Thus, if necessary, symbolic
|
||||||
|
links may be created to use the script easily.
|
||||||
|
|
||||||
${txtbld}For more information, please visit${txtrst}: \
|
${txtbld}For more information, please visit${txtrst}: \
|
||||||
<https://github.com/mkalewski/pdflatex.sh>
|
<https://github.com/mkalewski/pdflatex.sh>
|
||||||
|
@ -166,7 +168,8 @@ ${txtbld}Options${txtrst}:
|
||||||
output will be in a FILE-nup.pdf file)
|
output will be in a FILE-nup.pdf file)
|
||||||
-2x2 FILE put four pages of the PDF FILE on a single A4 sheet (the
|
-2x2 FILE put four pages of the PDF FILE on a single A4 sheet (the
|
||||||
output will be in a FILE-nup.pdf file)
|
output will be in a FILE-nup.pdf file)
|
||||||
+3 run 'latex'/'pdflatex'/'xelatex' thrice (default is twice)
|
+3 run 'latex'/'pdflatex'/'xelatex'/'lualatex' thrice
|
||||||
|
(default is twice)
|
||||||
-b FILE make ONLY BibTeX
|
-b FILE make ONLY BibTeX
|
||||||
+b make ALSO BibTeX
|
+b make ALSO BibTeX
|
||||||
-c FILE cleanup (remove auxiliary files)
|
-c FILE cleanup (remove auxiliary files)
|
||||||
|
@ -189,15 +192,15 @@ ${txtbld}Options${txtrst}:
|
||||||
-n FILE check non-breaking spaces
|
-n FILE check non-breaking spaces
|
||||||
+n disable output coloring during the compilation
|
+n disable output coloring during the compilation
|
||||||
+o open the resulting PDF (or DVI) file after the compilation
|
+o open the resulting PDF (or DVI) file after the compilation
|
||||||
+p use 'ps4pdf' instead of 'latex'/'pdflatex'/'xelatex'
|
+p use 'ps4pdf' instead of 'latex'/'pdflatex'/'xelatex'/
|
||||||
(the PSTricks package)
|
'lualtex' (the PSTricks package)
|
||||||
-s FILE check sentence separators
|
-s FILE check sentence separators
|
||||||
+s print a summary of problems (errors and warnings) after
|
+s print a summary of problems (errors and warnings) after
|
||||||
the compilation
|
the compilation
|
||||||
-sc [LANG] FILE start the interactive 'aspell' spell checker (by default
|
-sc [LANG] FILE start the interactive 'aspell' spell checker (by default
|
||||||
LANG="en_GB" and UTF-8 encoding is used)
|
LANG="en_GB" and UTF-8 encoding is used)
|
||||||
+shell enable the shell escape option of 'latex'/'pdflatex'/
|
+shell enable the shell escape option of 'latex'/'pdflatex'/
|
||||||
'xelatex'
|
'xelatex'/'lualatex'
|
||||||
-ss FILE STRICTLY check sentence separators
|
-ss FILE STRICTLY check sentence separators
|
||||||
+sync enable the synchronization between the source file and the
|
+sync enable the synchronization between the source file and the
|
||||||
resulting DVI or PDF file
|
resulting DVI or PDF file
|
||||||
|
@ -300,12 +303,13 @@ function convert_images() {
|
||||||
local IMGFILES=`find $1 -type f -iname "*.$CONVERTIMGRARG" 2>&-`
|
local IMGFILES=`find $1 -type f -iname "*.$CONVERTIMGRARG" 2>&-`
|
||||||
fi
|
fi
|
||||||
if [[ $CONVERTIMGARG == "svg" || $CONVERTIMGRARG == "svg" ]] ; then
|
if [[ $CONVERTIMGARG == "svg" || $CONVERTIMGRARG == "svg" ]] ; then
|
||||||
check_programs "$INKSCAPE_PROGRAM" #EPSTOPDF_PROGRAM
|
check_programs "$INKSCAPE_PROGRAM"
|
||||||
echo -ne "CONVERT IMAGES..."
|
echo -ne "CONVERT IMAGES..."
|
||||||
for IMG in $IMGFILES ; do
|
for IMG in $IMGFILES ; do
|
||||||
$INKSCAPE_PROGRAM -T -A "${IMG%.svg}.pdf" "$IMG" 2>/dev/null || die
|
$INKSCAPE_PROGRAM $INKSCAPE_OPT -A "${IMG%.svg}.pdf" "$IMG" 2>/dev/null \
|
||||||
$INKSCAPE_PROGRAM -T -P "${IMG%.svg}.ps" "$IMG" 2>/dev/null || die
|
|| die
|
||||||
#$EPSTOPDF_PROGRAM "${IMG%.svg}.eps"
|
$INKSCAPE_PROGRAM $INKSCAPE_OPT -P "${IMG%.svg}.ps" "$IMG" 2>/dev/null \
|
||||||
|
|| die
|
||||||
echo -ne "."
|
echo -ne "."
|
||||||
done
|
done
|
||||||
elif [[ $CONVERTIMGARG == "dia" || $CONVERTIMGRARG == "dia" ]] ; then
|
elif [[ $CONVERTIMGARG == "dia" || $CONVERTIMGRARG == "dia" ]] ; then
|
||||||
|
@ -428,7 +432,7 @@ function spell_checker() {
|
||||||
function run_pdflatex() {
|
function run_pdflatex() {
|
||||||
check_programs "$GREP"
|
check_programs "$GREP"
|
||||||
echo -ne "$TEXT..."
|
echo -ne "$TEXT..."
|
||||||
$LATEX_PROGRAM $LATEX_OPTIONS "$FILENAME" >&- 2>&-
|
$LATEX_PROGRAM $LATEX_OPTIONS "$FILENAME" &>/dev/null
|
||||||
local ERR=`$GREP -a -i error "$FILENAME".log | $GREP -a -v -i infwarerr`
|
local ERR=`$GREP -a -i error "$FILENAME".log | $GREP -a -v -i infwarerr`
|
||||||
if [[ -z $ERR ]] ; then
|
if [[ -z $ERR ]] ; then
|
||||||
local ERR=`$GREP -a -i "^\!" "$FILENAME".log`
|
local ERR=`$GREP -a -i "^\!" "$FILENAME".log`
|
||||||
|
@ -537,11 +541,13 @@ if [[ -n $CHKTEX ]] ; then
|
||||||
mquit $?
|
mquit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Command to use: 'latex', 'pdflatex', or 'xelatex':
|
# Command to use: 'latex', 'pdflatex', 'xelatex', or 'lualatex':
|
||||||
if [[ $THENAME == "latex.sh" ]] ; then
|
if [[ $THENAME == "latex.sh" ]] ; then
|
||||||
LATEX_PROGRAM=$LATEX_PROGRAM
|
LATEX_PROGRAM=$LATEX_PROGRAM
|
||||||
elif [[ $THENAME == "xelatex.sh" ]] ; then
|
elif [[ $THENAME == "xelatex.sh" ]] ; then
|
||||||
LATEX_PROGRAM=$XELATEX_PROGRAM
|
LATEX_PROGRAM=$XELATEX_PROGRAM
|
||||||
|
elif [[ $THENAME == "lualatex.sh" ]] ; then
|
||||||
|
LATEX_PROGRAM=$LUALATEX_PROGRAM
|
||||||
else
|
else
|
||||||
LATEX_PROGRAM=$PDFLATEX_PROGRAM
|
LATEX_PROGRAM=$PDFLATEX_PROGRAM
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue