Skip to content

Commit e75e948

Browse files
committed
Add a standalone variant to check_latex.
The packages and TikZ libraries that are used by pg are all tested (including the TikZ spath library that is going to be used once openwebwork/pg#1336 is merged). Note that the "active" option was removed from the preview package in the check_latex_article.tex and check_latex_exam.tex files because that suppresses output. It is enough to test that the preview package loads, and this makes the more important things that are being tested more like they are for actual hardcopy generation and not for equation generation. We really need to remove images mode.
1 parent d3708c5 commit e75e948

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

bin/check_latex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use feature 'say';
1313

1414
BEGIN {
1515
use Mojo::File qw(curfile);
16-
use YAML::XS qw(LoadFile);
17-
use Env qw(WEBWORK_ROOT PG_ROOT);
16+
use YAML::XS qw(LoadFile);
17+
use Env qw(WEBWORK_ROOT PG_ROOT);
1818

1919
$WEBWORK_ROOT = curfile->dirname->dirname->to_string;
2020

@@ -51,7 +51,9 @@ my $latex_cmd =
5151
. shell_quote($ce->{webworkDirs}{assetsTex}) . ':'
5252
. shell_quote($ce->{pg}{directories}{assetsTex}) . ': '
5353
. $ce->{externalPrograms}{latex2pdf}
54-
. ' -interaction nonstopmode check_latex_exam.tex >> check_latex.nfo 2>&1';
54+
. ' -interaction nonstopmode check_latex_exam.tex >> check_latex.nfo 2>&1 &&'
55+
. "TEXINPUTS=$ENV{WEBWORK_ROOT}/bin: $ce->{externalPrograms}{latex2pdf}"
56+
. ' -interaction nonstopmode check_latex_standalone.tex > check_latex.nfo 2>&1';
5557

5658
if ((system $latex_cmd) >> 8) {
5759
if (open(my $fh, '<', "$temp_dir/check_latex.nfo")) {

bin/check_latex_article.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
\usepackage{multicol}
99
\usepackage{tcolorbox}
1010

11-
\usepackage[active,textmath,displaymath]{preview} % needed for dvipng
11+
\usepackage[textmath,displaymath]{preview} % needed for dvipng
1212

1313
\setlength{\columnsep}{.25in}
1414
\setlength{\columnseprule}{.4pt}

bin/check_latex_exam.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
\usepackage{bidi}
1010
\fi
1111

12-
\usepackage[active,textmath,displaymath]{preview} % needed for dvipng
12+
\usepackage[textmath,displaymath]{preview} % needed for dvipng
1313

1414
\setlength{\columnsep}{.25in}
1515
\setlength{\columnseprule}{.4pt}

bin/check_latex_standalone.tex

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
\documentclass{standalone}
2+
3+
\usepackage[svgnames]{xcolor}
4+
\usepackage{tikz}
5+
\usepackage{pgfplots}
6+
\usetikzlibrary{arrows.meta,plotmarks,calc,spath3}
7+
\usepgfplotslibrary{fillbetween}
8+
\pgfplotsset{compat = 1.18}
9+
10+
\begin{document}
11+
12+
\begin{tikzpicture}
13+
\begin{axis}
14+
\addplot[name path=pathA, domain=-3:3, draw=none, mark=triangle*] {(x^2)};
15+
\draw[{Stealth}-{Stealth}, spath/use=pathA];
16+
\draw ($(-1, 0) + (10pt, 10pt)$) -- ($(1, 3) - (10pt, 10pt)$);
17+
\addplot[name path=pathB, domain=-3:3] {(-x^2 + 3)};
18+
\addplot[green, fill opacity=0.3] fill between[of=pathA and pathB];
19+
\end{axis}
20+
\end{tikzpicture}
21+
22+
\end{document}

0 commit comments

Comments
 (0)