File tree 7 files changed +30
-21
lines changed
7 files changed +30
-21
lines changed Original file line number Diff line number Diff line change 34
34
35
35
jq ' .data.options[] | select(.name=="latex").value' " $1 " -r >> $TEMPDIR /src.tex
36
36
37
- bash latex-render.sh " $TEMPDIR "
37
+ bash latex-render.sh " $TEMPDIR " " math "
38
38
39
39
if [ $? -eq 0 ]; then
40
40
# Success!
Original file line number Diff line number Diff line change 1
1
TEMPDIR=$1
2
+ TEXENV=$2
2
3
TEXFILE=$TEMPDIR /file.tex
3
4
4
-
5
- cat << END > $TEXFILE
6
- \documentclass[border=2pt]{standalone}
7
- \usepackage{amsmath}
8
- \usepackage{amsfonts}
9
- \usepackage{varwidth}
10
- \begin{document}
11
- \begin{varwidth}{\linewidth}
12
- \[
13
- END
14
-
15
- cat $TEMPDIR /src.tex >> $TEXFILE
16
-
17
- cat << END >> $TEXFILE
18
- \]
19
- \end{varwidth}
20
- \end{document}
21
- END
5
+ sed -e " /@CONTENT@/$TEMPDIR /src.tex" -e " d}" " tex-environments/$TEXENV .tex" > $TEXFILE
22
6
23
7
pdflatex --output-directory $TEMPDIR $TEXFILE > $TEMPDIR /tex.log 2> $TEMPDIR /tex-err.log && \
24
8
convert -density 300 -background white -alpha remove -quality 50 -colorspace RGB $TEMPDIR /file.pdf $TEMPDIR /file.png > $TEMPDIR /con.log 2> $TEMPDIR /con-err.log
Original file line number Diff line number Diff line change 11
11
12
12
jq ' .data.components[0].components[0].value' " $1 " -r >> $TEMPDIR /src.tex
13
13
14
- bash latex-render.sh " $TEMPDIR "
14
+ bash latex-render.sh " $TEMPDIR " " math "
15
15
16
16
if [ $? -eq 0 ]; then
17
17
# Success!
Original file line number Diff line number Diff line change
1
+ \documentclass [border=2pt ]{standalone }
2
+ \usepackage {amsmath }
3
+ \usepackage {amsfonts }
4
+ \usepackage {varwidth }
5
+ \begin {document }
6
+ \begin {varwidth }{\linewidth }
7
+
8
+ \[
9
+ @CONTENT@
10
+ \]
11
+
12
+ \end {varwidth }
13
+ \end {document }
Original file line number Diff line number Diff line change
1
+ \documentclass [border=2pt ]{standalone }
2
+ \usepackage {amsmath }
3
+ \usepackage {amsfonts }
4
+ \usepackage {varwidth }
5
+ \begin {document }
6
+ \begin {varwidth }{\linewidth }
7
+
8
+ @CONTENT@
9
+
10
+ \end {varwidth }
11
+ \end {document }
Original file line number Diff line number Diff line change
1
+ @CONTENT@
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ TEXFILE=$TEMPDIR/file.tex
5
5
6
6
echo $QUERY_STRING | base64 -d >> $TEMPDIR /src.tex
7
7
8
- bash latex-render.sh " $TEMPDIR "
8
+ bash latex-render.sh " $TEMPDIR " " math "
9
9
10
10
echo " Content-Type: image/png"
11
11
echo
You can’t perform that action at this time.
0 commit comments