-
Notifications
You must be signed in to change notification settings - Fork 1
/
pgf_example.tex
94 lines (90 loc) · 2.31 KB
/
pgf_example.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
\documentclass{article}
\usepackage[
paperheight=11in, paperwidth=12in,
hmargin=.75in, top=1in,
]{geometry}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{minted}
\usepackage{multicol}
\usepackage{lastpage}
\definecolor{bg}{rgb}{0.95,0.95,0.95}
\setminted{
fontsize=\small,
bgcolor=bg,
breaklines=true,
tabsize=2,
breakanywhere=true,
breaksymbolright=$\swarrow$,
breakanywheresymbolpre=,
breaksymbolleft=,
}
\usepackage{fancyhdr}
\pagestyle{fancy}
\rhead{Page \thepage\ of\ \pageref{LastPage}}
\chead{Eureka}
\lhead{PGF Example}
\cfoot{}
\ExplSyntaxOn
\cs_new:Npn \__input_tex_pdf:n #1 {
\begin{figure}[!htb]
\begin{multicols}{2}
\file_if_exist:nTF {./pics/example_#1.tex}
{
\inputminted{latex}{./pics/example_#1.tex}
}{
\typeout{File ./pics/example_#1.tex does not exist}
% \inputminted{latex}{./pics/subs.tex}
}
\columnbreak
\begin{center}
\file_if_exist:nT {./pics/example_#1.tex}{
\file_if_exist:nTF {./pics/example_#1.pdf}
{
\vspace*{0em}
\includegraphics[width=.55\linewidth]{./pics/example_#1.pdf}\par
\textsc{Figure:~ Example\_#1.pdf}
}{
\typeout{File ./pics/example_#1.pdf does not exist}
\vspace*{0em}
\includegraphics[width=.25\linewidth]{example-image-a}\par
\textsc{Figure:~ Example\_#1.pdf~ Missing}
}
}
\end{center}
\end{multicols}
% \caption{EXAMPLE~ #1}
\label{fig:example_#1}
\end{figure}
}
\int_new:N \g__current_example_max_int
\int_gset:Nn \g__current_example_max_int {0}
\NewDocumentCommand{\inputTexPDF}{O{1}m}
{
\int_step_inline:nnn {#1}{#2}
{
\__input_tex_pdf:n {##1}
\file_if_exist:nT {./pics/example_##1.tex}
{
\int_gadd:Nn \g__current_example_max_int {1}
\int_compare:nT {\g__current_example_max_int = 10}
{ \clearpage
\int_gset:Nn \g__current_example_max_int {0}
}
}
}
}
\ExplSyntaxOff
\begin{document}
\begin{titlepage}
\vspace*{\fill}\begin{center}
\begin{tabular}{c}
\textsc{\Huge Learn PGF by Examples} \\[5em]
Original from project:pgf-tikz/pgfplots \\[2em]
ReTypeset by Eureka \\[2em]
\today
\end{tabular}
\end{center}\vspace*{\fill}
\end{titlepage}
\inputTexPDF{524}
\end{document}