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

Using this script you can work on several latex/tex files and build their PDF's very easily and quickly.

To use this script save it into your 'bin' folder as 'pdfbuild', whether that's local or system-wide, and obviously make it executable. And then just call 'pdfbuild' in a terminal and follow the on-screen prompts to easily build your PDF file.

To adapt this script for your situation change the details in function 'choose' near the end of the script, using my setup as a template.

#!/bin/bash
#set -e

#: Title                : pdfbuild
#: Date               : 7th July 2017
#: Version          : 2.0
#: Description      : To build a PDF file from a pre-generated .tex file
#; Requirements     : texlive

# Copyright (C) 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/>.

#############
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; choose;;
                [Nn]* ) choose;;
        [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; choose;;
                [Nn]* ) choose;;
        [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; choose;;
                [Nn]* ) choose;;
        [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; choose;;
                [Nn]* ) choose;;
        [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; choose;;
                [Nn]* ) choose;;
        [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; choose;;
                [Nn]* ) choose;;
        [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; choose;;
                [Nn]* ) choose;;
        [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; choose;;
                [Nn]* ) choose;;
        [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; choose;;
                [Nn]* ) choose;;
        [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; choose;;
                [Nn]* ) choose;;
        [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; choose;;
                [Nn]* ) choose;;
        [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; choose;;
                [Nn]* ) choose;;
        [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
 };

function choose {
    echo;
    read -n1 -p ""$bldgrn" Please choose which you want,

              aging = a
              hair17 = f
              sandbox = x
              sandyford = y
              testing = z
              quit = q
 $(tput sgr0)" abcdefghijkmnprstuvw012345678xyzq
    case "$abcdefghijkmnprstuvw012345678xyzq" in
        [Aa]* ) cd ~/research/age-and-trans/general/; filename="aging"; ques;;
        [Ff]* ) cd ~/research/hair17/; filename="hair17"; ques;;
        [Xx]* ) cd ~/research/sandbox/death/; filename="sandbox"; ques;;
        [Yy]* ) cd ~/research/sandbox/sandyford/; filename="sandyford"; ques;;
        [Zz]* ) cd ~/research/testing/; filename="testing"; ques;;
        [Qq]* ) endex;;
            * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
 };

eval choose


Comments

comments powered by Disqus
m tag-3"> KDE
  • keyboard
  • latex
  • launchers
  • libreoffice
  • linux
  • LXDE
  • management
  • menus
  • mpd
  • music
  • obnam
  • org-mode
  • org2blog
  • passwords
  • pelican
  • productivity
  • script
  • series
  • software
  • squeeze
  • tex
  • todo lists
  • troubleshooting
  • truecrypt
  • tweaks
  • updated
  • user
  • wheezy
  • writing
  • yasnippet
  • Series