Created
October 20, 2017 10:28
-
-
Save vallettaventures/484ff776d045422b07b369c905e2a3f3 to your computer and use it in GitHub Desktop.
Script to reproduce bug in pdfTeX when using the subfolder option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Script to reproduce an issue with pdftex | |
# | |
# The issue occurs when | |
# - you are using the -output-folder option | |
# - you input some subfile without extension | |
# - a folder with that subfile name appears in that output folder | |
# | |
# Running this script will create $ROOTDIR, and an example document under $ROOTDIR | |
# In that folder will be 3 PDFs all of which I would expect to be the same | |
# However the third PDF will be missing content | |
ROOTDIR="/tmp/rootdir" | |
SUBDIRNAME="subdir" | |
ROOTFILENAME="main" | |
ROOTFILE="$ROOTDIR/$ROOTFILENAME.tex" | |
SUBDIR="$ROOTDIR/$SUBDIRNAME" | |
SUBFILE="$ROOTDIR/$SUBDIRNAME.tex" | |
OUTPUTFOLDER="$ROOTDIR/outputfolder" | |
# prepare the document | |
mkdir -p "$SUBDIR" | |
mkdir -p "$OUTPUTFOLDER" | |
echo "\\documentclass{article}" > "$ROOTFILE" | |
echo "\\begin{document}" >> "$ROOTFILE" | |
echo "1" >> "$ROOTFILE" | |
echo "\\input{$SUBDIRNAME}" >> "$ROOTFILE" | |
echo "2" > "$SUBFILE" | |
echo "3" >> "$ROOTFILE" | |
echo "\\end{document}" >> "$ROOTFILE" | |
# 1. Typeset without output folder, with the subfolder, this works fine | |
cd "$ROOTDIR" | |
pdflatex "$ROOTFILENAME" | |
mv "$ROOTFILENAME.pdf" "1-no-output-folder.pdf" | |
rm *.log *.aux | |
# 2. Typeset with the output folder, but without the problematic sub folder | |
pdflatex -output-directory "$OUTPUTFOLDER" "$ROOTFILENAME" | |
mv "$OUTPUTFOLDER/$ROOTFILENAME.pdf" "2-output-folder-no-subfolder.pdf" | |
rm "$OUTPUTFOLDER"/*.log "$OUTPUTFOLDER"/*.aux | |
# 3. Create the obscuring subfolder in the output folder, then typeset again, this pdf will be missing content | |
mkdir -p "$OUTPUTFOLDER/$SUBDIRNAME" | |
pdflatex -output-directory "$OUTPUTFOLDER" "$ROOTFILENAME" | |
mv "$OUTPUTFOLDER/$ROOTFILENAME.pdf" "3-output-folder-with-subfolder.pdf" | |
rm "$OUTPUTFOLDER"/*.log "$OUTPUTFOLDER"/*.aux |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment