diff --git a/LICENSE.txt b/LICENSE.txt index cbce532..48e41da 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2007-2016 Michal Kalewski +Copyright (c) 2007-2017 Michal Kalewski 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 diff --git a/README.rst b/README.rst index f5988d3..de312c4 100644 --- a/README.rst +++ b/README.rst @@ -3,7 +3,7 @@ pdflatex.sh =========== :Author: MichaƂ Kalewski -:Version: 3.4.0 +:Version: 3.5.0 :License: MIT License :Bug reports: https://github.com/mkalewski/pdflatex.sh/issues @@ -21,8 +21,8 @@ Synopsis Description =========== -A bash script to simplify TeX, LaTeX, and XeLaTeX files compilation with -bibliographies (BibTeX), glossaries (MakeGlossaries), indices (MakeIndex), +A bash script to simplify TeX, LaTeX, XeLaTeX, and LuaLaTeX files compilation +with bibliographies (BibTeX), glossaries (MakeGlossaries), indices (MakeIndex), PSTricks, and more. In the simplest case, the script is run as follows:: $ pdflatex.sh file.tex @@ -33,7 +33,7 @@ compilation. 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 -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 options_ and examples_). @@ -45,16 +45,14 @@ 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 `latex.sh`, -then the `latex` command is used (producing DVI output files), and if the -script is run as `xelatex.sh`, then the `xelatex` command is used (producing -PDF output files). Thus, if necessary, symbolic links may be created to use -the script easily, e.g.:: +then the `latex` command is used (producing DVI output files). Moreover, if +the script is run as `xelatex.sh` or `lualatex.sh`, then the `xelatex` or +`lualatex` command is used respectively (producing PDF output files). Thus, if +necessary, symbolic links may be created to use the script easily, e.g.:: $ ln -s ./pdflatex.sh ./latex.sh $ ln -s ./pdflatex.sh ./xelatex.sh - -**Arch Linux** users may use `tdi `_'s `AUR package -`_ to obtain the script. + $ ln -s ./pdflatex.sh ./lualatex.sh **OS X** users need to install GNU grep, i.e., ``ggrep``, which is required for 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 FILE-nup.pdf file). ``+3`` - Run ``latex``/``pdflatex``/``xelatex`` thrice (default is twice). + Run ``latex``/``pdflatex``/``xelatex``/``lualatex`` thrice (default is + twice). ``-b FILE`` Make ONLY BibTeX. ``+b`` @@ -110,8 +109,8 @@ Options ``+o`` Open the resulting PDF (or DVI) file after the compilation. ``+p`` - Use ``ps4pdf`` instead of ``latex``/``pdflatex``/``xelatex`` (the - `"PSTricks" `_ package). + Use ``ps4pdf`` instead of ``latex``/``pdflatex``/``xelatex``/``lualatex`` + (the `"PSTricks" `_ package). ``-s FILE`` Check sentence separators. ``+s`` @@ -120,8 +119,9 @@ Options Start the interactive ``aspell`` spell checker (by default ``LANG="en_GB"`` and UTF-8 encoding is used). ``+shell`` - Enable the shell escape option of ``latex``/``pdflatex``/``xelatex`` (e.g., - for the `"minted" `_ package). + Enable the shell escape option of + ``latex``/``pdflatex``/``xelatex``/``lualatex`` (e.g., for the `"minted" + `_ package). ``-ss FILE`` STRICTLY check sentence separators. ``+sync`` @@ -174,7 +174,7 @@ Examples Copyright ========= -| (c) 2007-2016 Michal Kalewski +| (c) 2007-2017 Michal Kalewski | | This program comes with ABSOLUTELY NO WARRANTY. | THIS IS FREE SOFTWARE, AND YOU ARE WELCOME TO REDISTRIBUTE IT UNDER THE TERMS diff --git a/pdflatex.sh b/pdflatex.sh index 1a7a43f..64f7f73 100755 --- a/pdflatex.sh +++ b/pdflatex.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # UTF-8 -# (c) 2007-2016 Michal Kalewski +# (c) 2007-2017 Michal Kalewski # # This program comes with ABSOLUTELY NO WARRANTY. # THIS IS FREE SOFTWARE, AND YOU ARE WELCOME TO REDISTRIBUTE IT UNDER THE @@ -21,8 +21,8 @@ # | -sc [LANG] FILE(.tex) # # DESCRIPTION -# A bash script to simplify TeX/LaTeX/XeLaTeX files compilation and more. -# Just run the script to get more information: './pdflatex.sh'. +# A bash script to simplify TeX/LaTeX/XeLaTeX/LuaLaTeX files compilation and +# more. Just run the script to get more information: './pdflatex.sh'. # # REPORTING BUGS # @@ -34,7 +34,7 @@ # VERSION # ======= -VERSION=3.4.0 +VERSION=3.5.0 # PROGRAMS @@ -44,14 +44,14 @@ BIBTEX_PROGRAM="bibtex" CHKTEX_PROGRAM="chktex" DETEX_PROGRAM="detex" DIA_PROGRAM="dia" -#EPSTOPDF_PROGRAM="epstopdf" # obsolete INKSCAPE_PROGRAM="inkscape" LATEX_PROGRAM="latex" -MAKEINDEX_PROGRAM="makeindex" +LUALATEX_PROGRAM="lualatex" MAKEGLOSSARIES_PROGRAM="makeglossaries" -PDF_VIEWER_PROGRAM="evince" +MAKEINDEX_PROGRAM="makeindex" PDFLATEX_PROGRAM="pdflatex" PDFNUP_PROGRAM="pdfnup" +PDF_VIEWER_PROGRAM="evince" PS4PDF_PROGRAM="ps4pdf" XELATEX_PROGRAM="xelatex" @@ -62,12 +62,13 @@ ASPELL_ENC_OPT="--encoding=utf-8" ASPELL_LANG_OPT="-l en_GB" CHKTEX_OPT="-q -v1" GREP_COLOR="--color=auto" +INKSCAPE_OPT="" # ="-T" # converts text objects to paths on export LATEX_BATCHMODE_OPT="-interaction batchmode" LATEX_SHELL_ESCAPE_OPT="-shell-escape" +MAKEGLOSSARIES_OPT="-q" PDFLATEX_SYNCTEX_OPT="-synctex=1" PDFNUP_OPT="--paper a4paper --frame true --scale 0.96 --delta \"2mm 2mm\"" PS4PDF_LATEX_OPT="\AtBeginDocument{\RequirePackage{pst-pdf}}" -MAKEGLOSSARIES_OPT="-q" # 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_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" # Base name of the script: @@ -128,18 +129,19 @@ set +H function print_help() { cat < - ${txtund}A BASH SCRIPT TO SIMPLIFY TeX/LaTeX/XeLaTeX FILES COMPILATION\ - AND MORE${txtrst} +${txtund}A BASH SCRIPT TO SIMPLIFY TeX/LaTeX/XeLaTeX/LuaLaTeX FILES\ + COMPILATION AND MORE${txtrst} 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 'latex.sh', then the 'latex' command is used (producing DVI output - files), and if the script is run as 'xelatex.sh', then the 'xelatex' - command is used (producing PDF output files). Thus, if necessary, - symbolic links may be created to use the script easily. + files). Moreover, if the script is run as 'xelatex.sh' or + 'lualatex.sh', then the 'xelatex' or 'lualatex' command is used + 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}: \ @@ -166,7 +168,8 @@ ${txtbld}Options${txtrst}: output will be in a FILE-nup.pdf file) -2x2 FILE put four pages of the PDF FILE on a single A4 sheet (the 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 make ALSO BibTeX -c FILE cleanup (remove auxiliary files) @@ -189,15 +192,15 @@ ${txtbld}Options${txtrst}: -n FILE check non-breaking spaces +n disable output coloring during the compilation +o open the resulting PDF (or DVI) file after the compilation - +p use 'ps4pdf' instead of 'latex'/'pdflatex'/'xelatex' - (the PSTricks package) + +p use 'ps4pdf' instead of 'latex'/'pdflatex'/'xelatex'/ + 'lualtex' (the PSTricks package) -s FILE check sentence separators +s print a summary of problems (errors and warnings) after the compilation -sc [LANG] FILE start the interactive 'aspell' spell checker (by default LANG="en_GB" and UTF-8 encoding is used) +shell enable the shell escape option of 'latex'/'pdflatex'/ - 'xelatex' + 'xelatex'/'lualatex' -ss FILE STRICTLY check sentence separators +sync enable the synchronization between the source file and the resulting DVI or PDF file @@ -300,12 +303,13 @@ function convert_images() { local IMGFILES=`find $1 -type f -iname "*.$CONVERTIMGRARG" 2>&-` fi if [[ $CONVERTIMGARG == "svg" || $CONVERTIMGRARG == "svg" ]] ; then - check_programs "$INKSCAPE_PROGRAM" #EPSTOPDF_PROGRAM + check_programs "$INKSCAPE_PROGRAM" echo -ne "CONVERT IMAGES..." for IMG in $IMGFILES ; do - $INKSCAPE_PROGRAM -T -A "${IMG%.svg}.pdf" "$IMG" 2>/dev/null || die - $INKSCAPE_PROGRAM -T -P "${IMG%.svg}.ps" "$IMG" 2>/dev/null || die - #$EPSTOPDF_PROGRAM "${IMG%.svg}.eps" + $INKSCAPE_PROGRAM $INKSCAPE_OPT -A "${IMG%.svg}.pdf" "$IMG" 2>/dev/null \ + || die + $INKSCAPE_PROGRAM $INKSCAPE_OPT -P "${IMG%.svg}.ps" "$IMG" 2>/dev/null \ + || die echo -ne "." done elif [[ $CONVERTIMGARG == "dia" || $CONVERTIMGRARG == "dia" ]] ; then @@ -428,7 +432,7 @@ function spell_checker() { function run_pdflatex() { check_programs "$GREP" 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` if [[ -z $ERR ]] ; then local ERR=`$GREP -a -i "^\!" "$FILENAME".log` @@ -537,11 +541,13 @@ if [[ -n $CHKTEX ]] ; then mquit $? fi -# Command to use: 'latex', 'pdflatex', or 'xelatex': +# Command to use: 'latex', 'pdflatex', 'xelatex', or 'lualatex': if [[ $THENAME == "latex.sh" ]] ; then LATEX_PROGRAM=$LATEX_PROGRAM elif [[ $THENAME == "xelatex.sh" ]] ; then LATEX_PROGRAM=$XELATEX_PROGRAM +elif [[ $THENAME == "lualatex.sh" ]] ; then + LATEX_PROGRAM=$LUALATEX_PROGRAM else LATEX_PROGRAM=$PDFLATEX_PROGRAM fi