Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for externalizing tikz images. #34

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/latex-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
uses: xu-cheng/latex-action@v2
with:
root_file: main.tex
latexmk_shell_escape: true

- name: Upload Artifact
uses: actions/upload-artifact@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
with:
working_directory: 'taoe3'
root_file: 'main.tex'
latexmk_shell_escape: true

- name: Checkout gh_pages branch
uses: actions/checkout@v2
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@
# latexrun
latex.out/

## Tikz externalize files
*.makefile
*.figlist
*.auxlock
Binary file modified main.pdf
Binary file not shown.
73 changes: 51 additions & 22 deletions taoesolutions.sty
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

\usepackage{circuitikz}
\usepackage{pgfplots}
\usepackage{environ}
\usepackage{amsmath}
\usepackage{cancel}
\usepackage{enumitem}
Expand All @@ -13,6 +14,10 @@
]{geometry}
\usepackage[toc]{multitoc}

\usetikzlibrary{external}
\tikzexternalize[prefix=tikz-cache/]
% \tikzexternalize[prefix=tikz-cache/, mode=list and make]

% Remove the "Chapter" label on each chapter
\usepackage{titlesec}
\titleformat{\chapter}[display]
Expand Down Expand Up @@ -43,39 +48,63 @@
\newcommand{\ave}{\ensuremath{\text{ave}}} % average
\newcommand{\eq}{\ensuremath{\text{eq}}} % equivalent

\newenvironment{circuit}[2]% param1=label, param2=caption
{
\begin{figure}[H]
\NewEnviron{circuit}[2]{%
\begin{figure}[H]
\caption{#2}
\label{#1}

\begin{center}
% \centering
\begin{circuitikz}[american]\draw
}
{
\begin{center}
\begin{tikzpicture}[american]\draw
\BODY
;
\end{circuitikz}
\end{tikzpicture}
\end{center}
\end{figure}
}
\end{figure}}

% \newenvironment{circuit}[2]% param1=label, param2=caption
% {
% \begin{figure}[H]
% \caption{#2}
% \label{#1}

% \begin{center}
% % \centering
% \begin{tikzpicture}[american]\draw
% }
% {
% ;
% \end{tikzpicture}
% \end{center}
% \end{figure}
% }

\newenvironment{plot}[2]% param1=label, param2=caption
{
\begin{figure}[H]
\NewEnviron{plot}[2]{%
\begin{figure}[H]
\caption{#2}
\label{#1}

\begin{center}
% \centering
\begin{center}
\begin{tikzpicture}[scale=0.8, samples=200]\draw
}
{
\BODY
;
\end{tikzpicture}
\end{center}
\end{figure}
}
\end{figure}}

% \newenvironment{plot}[2]% param1=label, param2=caption
% {
% \begin{figure}[H]
% \caption{#2}
% \label{#1}

% \begin{center}
% % \centering
% \begin{tikzpicture}[scale=0.8, samples=200]\draw
% }
% {
% ;
% \end{tikzpicture}
% \end{center}
% \end{figure}
% }
% Set first level of list to (a) format
\setlist[enumerate,1]{label=(\alph*)}

Expand Down
6 changes: 6 additions & 0 deletions tikz-cache/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This tikz-cache folder is here to cache the tikz images.
# It is needed by the \tikzpackage{external} library.
# This folder is not automatically generated, so it's tracked in version control
# to prevent new users from seeing cryptic compile errors.
*
!.gitignore