Skip to content

Commit

Permalink
resolves #1553 extract error message (#1616)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Aug 20, 2023
1 parent db57781 commit a0af394
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tikz/tikz2svg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# Converts PGF/TikZ on stdin to one of the supported output formats (jpeg,
# pdf, png, svg) on stdout.

set -x
set -e

# Latex Options:
Expand Down Expand Up @@ -77,6 +76,10 @@ output_format="$1"
tempdir=$(mktemp --directory)

cleanup() {
if [ -f "$tempdir/file.log" ]; then
# retrieve errors
cat "$tempdir/file.log" | awk '/^\!/,/^l\.[0-9]+/ { print $0 }'
fi
rm -rf $tempdir
}

Expand All @@ -88,7 +91,7 @@ cd $tempdir
cat >raw_input.tex

maybe_add_documentclass $output_format raw_input.tex > file.tex
latex $LATEX_OPTIONS -output-format=$(intermediate_format $output_format) file.tex 1>&2
latex $LATEX_OPTIONS -output-format=$(intermediate_format $output_format) file.tex >/dev/null

case "$output_format" in
jpeg|png)
Expand Down

0 comments on commit a0af394

Please sign in to comment.