Skip to content

Bash script to ease use #28

@coburnw

Description

@coburnw

Before finding your project, i had never used latex. Its no small task for the noephyte. I created this automation script to speed the relearn process that comes from extended periods between projects. Please do with what you like.

assumptions:

  • debian apt install texlive
  • pip install docal

Thanks again for a great project.

#!/bin/bash

if [ -z "$1" ]; then
    echo "usage: $0 target"
    echo
    echo "expects:"
    echo "  target.py           containing the docal calculations"
    echo "  target-template.tex the template in latex format"
    echo
    echo "outputs:"
    echo "  target.tex          the merged latex document"
    echo "  target.pdf          converted to pdf format"
    exit
fi

TARGET=$1

# create tex file
docal $TARGET.py -i $TARGET-template.tex -o $TARGET.tex
RETURN=$?

# convert to pdf
if [ $RETURN -eq 0 ];
then
    pdflatex --interaction nonstopmode $TARGET.tex
fi

# start the evince pdf viewer if not already running
# (evince auto detects file change and will reload on its own)
if ! pgrep -f $TARGET.pdf ; then
    echo "starting evince"
    evince $TARGET.pdf &
fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions