This is my 'pdfbuild' bash script that converts 'tex' files to a PDF. You generate the '.tex' files in any way you want to build them. I =used= to build the latex files by hand, which was very slow and laborious, but gave extremely good results. Currently I'm building the latex files after exporting from org-mode, and my template is in post org2latex

To use this script save it into your 'bin' folder as 'pdfbuild', whether that's local or system-wide, obviously make it executable, and you must set the path of your '.tex' file in Variables =exactly= as shown for the script to run properly. And then just call 'pdfbuild' in a terminal and follow the on-screen prompts to easily build your PDF file.

#!/bin/bash
#set -e

# Copyright (C) 2015, 2016, 2017 Sharon Kimble <[email protected]>

# Author: Sharon Kimble <[email protected]>

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#variables
cd ~/research/hair/; filename="hair2016"
# cd ~/research/aging/; filename="aging2017"

#############
bldgrn=${txtbld} echo -e "\e[92m"
txtbld=$(tput bold)
bldgrn=${txtbld}$(tput setaf 2)

function endex {
    echo;
    sleep 0;
    #clear;
    exit 0;
}


function one {
    echo
    read -n1 -p ""$bldgrn" Do you want one pass?
                              yes = y
                              no = n
                              quit = q
                              restart = r
 $(tput sgr0)" ynqr
        case "$ynqr" in
                [Yy]* ) xelatex  $filename; ques;;
                [Nn]* ) ques;;
        [Qq]* ) endex;;
        [Rr]* ) exec "$pdfbuild";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};
function double {
    echo
    read -n1 -p ""$bldgrn" Do you want a double pass?
                              yes = y
                              no = n
                              quit = q
                              restart = r
 $(tput sgr0)" ynqr
        case "$ynqr" in
                [Yy]* ) xelatex  $filename; xelatex  $filename; ques;;
                [Nn]* ) ques;;
        [Qq]* ) endex;;
        [Rr]* ) exec "$pdfbuild";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};
function treble {
    echo
    read -n1 -p ""$bldgrn" Do you want a treble pass?
                              yes = y
                              no = n
                              quit = q
                              restart = r
 $(tput sgr0)" ynqr
        case "$ynqr" in
                [Yy]* ) xelatex  $filename; xelatex  $filename; xelatex  $filename; ques;;
                [Nn]* ) ques;;
        [Qq]* ) endex;;
        [Rr]* ) exec "$pdfbuild";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};
function partwrite {
    echo
    read -n1 -p ""$bldgrn" Do you want a part-write pass?
                              yes = y
                              no = n
                              quit = q
                              restart = r
 $(tput sgr0)" ynqr
        case "$ynqr" in
                [Yy]* ) xelatex $filename; biber $filename; xelatex $filename; ques;;
                [Nn]* ) ques;;
        [Qq]* ) endex;;
        [Rr]* ) exec "$pdfbuild";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};


function penta {
    echo
    read -n1 -p ""$bldgrn" Do you want a penta pass? [x5]
                              yes = y
                              no = n
                              quit = q
                              restart = r
 $(tput sgr0)" ynqr
        case "$ynqr" in
                [Yy]* ) xelatex $filename; xelatex $filename; xelatex $filename; xelatex $filename; xelatex $filename; ques;;
                [Nn]* ) ques;;
        [Qq]* ) endex;;
        [Rr]* ) exec "$pdfbuild";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};

function onebib {
    echo
    read -n1 -p ""$bldgrn" Do you want one pass including the bib file?
                              yes = y
                              no = n
                              quit = q
                              restart = r
 $(tput sgr0)" ynqr
        case "$ynqr" in
                [Yy]* ) biber $filename; xelatex $filename; ques;;
                [Nn]* ) ques;;
        [Qq]* ) endex;;
        [Rr]* ) exec "$pdfbuild";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};
function multipass {
    echo
    read -n1 -p ""$bldgrn" Do you want a pass including glossary, bibliography?
                              yes = y
                              no = n
                              quit = q
                              restart = r
 $(tput sgr0)" ynqr
        case "$ynqr" in
                [Yy]* ) xelatex  $filename; biber  $filename; makeindex  $filename; makeglossaries  $filename; xelatex  $filename; ques;;
                [Nn]* ) ques;;
        [Qq]* ) endex;;
        [Rr]* ) exec "$pdfbuild";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};
function extend {
    echo
    read -n1 -p ""$bldgrn" Do you want an extended pass?
                              yes = y
                              no = n
                              quit = q
                              restart = r
 $(tput sgr0)" ynqr
        case "$ynqr" in
                [Yy]* ) makeglossaries  $filename; biber  $filename; makeindex  $filename; xelatex  $filename; biber  $filename; makeindex  $filename; makeglossaries  $filename; xelatex  $filename; ques;;
                [Nn]* ) ques;;
        [Qq]* ) endex;;
        [Rr]* ) exec "$pdfbuild";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};
function bibi {
    echo
    read -n1 -p ""$bldgrn" Do you want a bibliography only?
                              yes = y
                              no = n
                              quit = q
                              restart = r
 $(tput sgr0)" ynqr
        case "$ynqr" in
                [Yy]* ) biber $filename; ques;;
                [Nn]* ) ques;;
        [Qq]* ) endex;;
        [Rr]* ) exec "$pdfbuild";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};
function slog {
    echo
    read -n1 -p ""$bldgrn" Do you want a glossary only?
                              yes = y
                              no = n
                              quit = q
                              restart = r
 $(tput sgr0)" ynqr
        case "$ynqr" in
                [Yy]* ) makeglossaries  $filename; ques;;
                [Nn]* ) ques;;
        [Qq]* ) endex;;
        [Rr]* ) exec "$pdfbuild";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};

function xedni {
    echo
    read -n1 -p ""$bldgrn" Do you want an index only?
                              yes = y
                              no = n
                              quit = q
                              restart = r
 $(tput sgr0)" ynqr
        case "$ynqr" in
                [Yy]* ) makeindex $filename; ques;;
                [Nn]* ) ques;;
        [Qq]* ) endex;;
        [Rr]* ) exec "$pdfbuild";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};

function ultimate {
    echo
    read -n1 -p ""$bldgrn" Do you want the ultimate pass-through?
                              yes = y
                              no = n
                              quit = q
                              restart = r
 $(tput sgr0)" ynqr
        case "$ynqr" in
                    [Yy]* ) xelatex  $filename; biber  $filename; makeindex  $filename; makeglossaries  $filename; biber  $filename; makeindex  $filename; xelatex  $filename; biber  $filename; makeindex  $filename; makeglossaries  $filename; xelatex  $filename; xelatex  $filename; xelatex  $filename; xelatex  $filename; ques;;
                [Nn]* ) ques;;
        [Qq]* ) endex;;
        [Rr]* ) exec "$pdfbuild";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};
function ques {
    echo;
    read -n1 -p ""$bldgrn" Please choose which you want,
                   One-pass = r
                   Double-pass = d
                   Treble pass = t
                   Part-write pass = w
                   Penta pass = p
                   One-pass + Bib = o
                   MultiPass = m
                   Extended pass = x
                   Ultimate pass = u
                   Bibliography only = b
                   Glossary only = g
                   Index only = i
                   quit = q
 $(tput sgr0)" rdtwpomxubqiq
    case "$rdtwpomxubqiq" in
        [Rr]* ) one;;
        [Dd]* ) double;;
        [Tt]* ) treble;;
        [Ww]* ) partwrite;;
        [Pp]* ) penta;;
        [Oo]* ) onebib;;
    [Mm]* ) multipass;;
    [Xx]* ) extend;;
    [Uu]* ) ultimate;;
  [Bb]* ) bibi;;
    [Gg]* ) slog;;
    [Ii]* ) xedni;;
    [Qq]* ) endex;;
            * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
 };

eval ques


Comments

comments powered by Disqus