Commit 6160625d authored by Alija Sabic's avatar Alija Sabic
Browse files

Refactor document setup to use standalone exclusively, get rid of subfile...

Refactor document setup to use standalone exclusively, get rid of subfile package. Enhance Makefile, provide usage intstructions.
parent 0b23c96f
# -*- cperl -*- # -*- cperl -*-
# latexmkrc # latexmkrc
$builddir = $ENV{'BUILDDIR'};
$depsfile = $ENV{'DEPSFILE'};
$recorder = 1; $recorder = 1;
$pdf_mode = 1; $pdf_mode = 1;
$bibtex_use = 2; $bibtex_use = 2;
...@@ -7,8 +10,9 @@ $force_mode = 1; ...@@ -7,8 +10,9 @@ $force_mode = 1;
$dependents_list = 1; $dependents_list = 1;
$silence_logfile_warnings = 0; $silence_logfile_warnings = 0;
$use_make_for_missing_files = 1; $use_make_for_missing_files = 1;
$out_dir = $ENV{'BUILDDIR'}; $out_dir = $builddir;
$deps_file = "$out_dir/$ENV{'TARGET'}.deps"; $deps_file = "$out_dir/$depsfile.deps";
print $deps_file;
@BIBINPUTS = ('.',$ENV{'BIBDIRS'}); @BIBINPUTS = ('.',$ENV{'BIBDIRS'});
$pdflatex = 'pdflatex %O -interaction=nonstopmode -synctex=1 -file-line-error %S'; $pdflatex = 'pdflatex %O -interaction=nonstopmode -synctex=1 -file-line-error %S';
......
BASENAME = demo BASENAME = demo
BUILDDIR = build BUILDDIR = build
# Environment # environment
TEXDIRS = resources/tex:resources/latex-sty:resources/listings:resources/latex:resources/images:resources/tables:resources/latex:resources/figures TEXDIRS = resources/tex:resources/latex-sty:resources/listings:resources/latex
BIBDIRS = resources/latex/ TEXDIRS := $(TEXDIRS):resources/images:resources/tables:resources/latex
BSTDIR = resources/latex-bst/ TEXDIRS := $(TEXDIRS):resources/figures
BIBDIRS = resources/latex/
BSTDIR = resources/latex-bst/
# cf. latexmkrc # cf. latexmkrc
LATEXMKS = export TARGET=$(basename $(notdir $1)).pdf && $(call LATEXMK, $(basename $1)$2) LATEXMK = latexmk $(OPTS)$1
LATEXMK = latexmk $1 VIEWER = xdg-open
VIEWER = xdg-open
# main targets LATEXMK_COND = @export DEPSFILE=$(notdir $(basename $(TARGET))) && \
all: $(BASENAME).build $(if $(strip $(TARGET)), \
view: $(BASENAME).view $(call LATEXMK, $(basename $(TARGET))$1), \
preview: $(BASENAME).preview $(call LATEXMK, $(BASENAME)$1) \
clean: $(BASENAME).clean && echo '' && echo $(INSTRUCTIONS))
distclean: $(BASENAME).distclean
# dynamic targets LATEXMK_ERRS = $(if $(strip $1), \
%.build: $(call LOG, $(BUILDDIR)/$(basename $1).log), \
$(call LATEXMKS, $@, ) $(call LOG, $(BUILDDIR)/$(basename $(BASENAME)).log) \
)
%.view: all: build
$(call LATEXMKS, $@, -pv)
%.preview: build: setup
$(call LATEXMKS, $@, -pvc) $(call LATEXMK_COND, )
%.clean: log:
$(call LATEXMKS, $@, -c) $(call LATEXMK_ERRS, $(TARGET))
%.distclean: view: setup
$(call LATEXMKS, $@, -C) $(call LATEXMK_COND, -pv)
preview: setup
$(call LATEXMK_COND, -pvc)
clean: setup
$(call LATEXMK_COND, -c)
distclean: setup
$(call LATEXMK_COND, -C)
help:
@echo $(INSTRUCTIONS)
%/: %/:
mkdir -p $@ mkdir -p $@
setup: .FORCE | $(BUILDDIR)/
ccpri=$(shell echo "\033[0;36m")
ccacc=$(shell echo "\033[0;33m")
ccend=$(shell echo "\033[0m")
dollar=`echo '\$$'`
DELIM = $(ccacc)------------\n------------$(ccend)
ERRS = error
LOG = @echo "$(DELIM)\n" && grep $(ERRS) $1 -A4 -B4 | \
sed --expression='s/--/\n$(DELIM)\n/g' | \
grep --color -E -e '' -e '$(ERRS)' && echo "\n$(DELIM)"
INSTRUCTIONS = "$(ccpri)------------------------------------------------------" \
"\n=$(ccend) Help Instructions $(ccpri)=" \
"\n$(ccpri)------------------------------------------------------$(ccend)\n" \
"\n Provided targets:\n\n build, view, preview, log, clean, distclean, help\n" \
"\n Set $(ccpri)$(dollar)TARGET$(ccend) to specify the tex file to" \
"compile \n and $(ccpri)$(dollar)OPTS$(ccend) for additional options" \
"to pass to latexmk.\n" \
"\n Examples:\n" \
"\n $(dollar) make $(ccacc)TARGET$(ccend)=tex/figures/logo $(ccacc)OPTS$(ccend)=-gg"\
"\n $(dollar) make $(ccacc)TARGET$(ccend)=tex/figures/logo clean" \
"\n\n or set permanently\n" \
"\n $(dollar) export $(ccacc)TARGET$(ccend)=tex/chapter.tex" \
"\n $(dollar) make" \
"\n $(dollar) make preview" \
"\n $(dollar) make clean" \
"\n\n or unset $(ccacc)$(dollar)TARGET$(ccend) to turn off this help instruction."
.PHONY: all clean distclean .FORCE .PHONY: all clean distclean .FORCE
# Export all variables by default # export all variables by default
.EXPORT_ALL_VARIABLES: .EXPORT_ALL_VARIABLES:
TEXINPUTS := :.:$(TEXDIRS) TEXINPUTS := :.:$(TEXDIRS)
# bibtex invoked from BUILDDIR, thus prepend './../' # bibtex invoked from BUILDDIR, thus prepend './../'
BSTINPUTS := ./../$(BSTDIR) BSTINPUTS := ./../$(BSTDIR)
BIBINPUTS := :.:./../$(BIBDIRS) BIBINPUTS := :.:./../$(BIBDIRS)
# Disable implicit suffix and built-in rules (for performance and profit) # disable implicit suffix and built-in rules (for performance and profit)
.SUFFIXES: .SUFFIXES:
MAKEFLAGS += --no-builtin-rules MAKEFLAGS += --no-builtin-rules
\ No newline at end of file
No preview for this file type
...@@ -4,75 +4,7 @@ ...@@ -4,75 +4,7 @@
% Document Setup % Document Setup
% ---------------------------------------------------------------------------------------------------------------------------- % ----------------------------------------------------------------------------------------------------------------------------
\usepackage[subpreambles,sort]{standalone} \usepackage[subpreambles,sort]{standalone}
\usepackage{preamble}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
% ----------------------------------------------------------------------------------------------------------------------------
% Bibliography/References
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage[square,numbers,sort]{natbib}
\bibliographystyle{IEEEtranSNC}
% --------------------------------------------------------------------------------------------------------------------------------
% Acronyms
% --------------------------------------------------------------------------------------------------------------------------------
% \usepackage[hyperref=true]{acro}
\usepackage{acro}
\usepackage{enumitem}
\acsetup{ first-long-format = \itshape }
\acsetup{ list-foreign-format = \itshape\acroenparen }
\newlist{acronyms}{description}{1}
\setlist[acronyms]{labelwidth = 5em}
\DeclareAcroListStyle{acrostyle}{list}{ list = acronyms }
\acsetup{ list-style = acrostyle }
\input{acronyms}
% ----------------------------------------------------------------------------------------------------------------------------
% Languagues
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage[french,german,english]{babel}
% ----------------------------------------------------------------------------------------------------------------------------
% Units
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage[binary-units]{siunitx}
\usepackage{xfrac}
\sisetup{quotient-mode=fraction,fraction-function=\sfrac,product-units=single,exponent-product=\times}
% ----------------------------------------------------------------------------------------------------------------------------
% Tables
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage{booktabs,tabu}
\usepackage{multirow}
\usepackage{multicol}
% ----------------------------------------------------------------------------------------------------------------------------
% Packages
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage{blindtext}
\usepackage{fhtw}
\usepackage{graphicx}
\usepackage{textcomp}
% \usepackage{hyperref}
% \usepackage{adjustbox}
\usepackage[graphicx]{realboxes}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\usepackage{tikz-timing}
\usepackage{xcolor}
\definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784}%
\definecolor{bgred}{rgb}{1,0.61569,0.61569}%
\definecolor{fgblue}{rgb}{0,0,0.6}%
\definecolor{fgred}{rgb}{0.6,0,0}%
% TODO: provide examples
% \usepackage{usebib}
% \bibinput{references}
% ---------------------------------------------------------------------------------------------------------------------------- % ----------------------------------------------------------------------------------------------------------------------------
% ---------------------------------------------------------------------------------------------------------------------------- % ----------------------------------------------------------------------------------------------------------------------------
...@@ -95,17 +27,17 @@ ...@@ -95,17 +27,17 @@
% ------------------------------------------------------------------------------------------------------------------------ % ------------------------------------------------------------------------------------------------------------------------
% Chapter 01 % Chapter 01
% ------------------------------------------------------------------------------------------------------------------------ % ------------------------------------------------------------------------------------------------------------------------
\subfile{chapter01} \input{chapter01}
% ------------------------------------------------------------------------------------------------------------------------ % ------------------------------------------------------------------------------------------------------------------------
% Chapter 02 % Chapter 02
% ------------------------------------------------------------------------------------------------------------------------ % ------------------------------------------------------------------------------------------------------------------------
\subfile{chapter02} \input{chapter02}
% ------------------------------------------------------------------------------------------------------------------------ % ------------------------------------------------------------------------------------------------------------------------
% Chapter 03 % Chapter 03
% ------------------------------------------------------------------------------------------------------------------------ % ------------------------------------------------------------------------------------------------------------------------
\subfile{chapter03} \input{chapter03}
% ------------------------------------------------------------------------------------------------------------------------ % ------------------------------------------------------------------------------------------------------------------------
% Bibliography/References % Bibliography/References
......
\documentclass[tikz, border=10pt]{standalone} \documentclass[tikz, border=10pt]{standalone}
% \usetikzlibrary{arrows} \usetikzlibrary{arrows}
% \usetikzlibrary{shapes} \usetikzlibrary{shapes}
\begin{document} \begin{document}
......
% Author: Marek Fiser <tikz at marekfiser.cz> % Author: Marek Fiser <tikz at marekfiser.cz>
% MESIF protocol: http://en.wikipedia.org/wiki/MESIF_protocol % MESIF protocol: http://en.wikipedia.org/wiki/MESIF_protocol
\documentclass[tikz, border=10pt]{standalone} \documentclass[tikz, border=10pt]{standalone}
% \usetikzlibrary{arrows}
\usetikzlibrary{arrows}
\begin{document} \begin{document}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm, \begin{tikzpicture}[
thick,main node/.style={circle,fill=blue!20,draw, ->,>=stealth',shorten >=1pt,auto,node distance=3cm,thick,
font=\sffamily\Large\bfseries,minimum size=15mm}] main node/.style={circle,fill=blue!20,draw,font=\sffamily\Large\bfseries,minimum size=15mm}]
\node[main node] (M) {M};
\node[main node] (E) [below of=M] {E}; \node[main node] (M) {M};
\node[main node] (S) [below of=E] {S}; \node[main node] (E) [below of=M] {E};
\node[main node] (F) [below of=S] {F}; \node[main node] (S) [below of=E] {S};
\node[main node] (I) [below of=F] {I}; \node[main node] (F) [below of=S] {F};
\path[every node/.style={font=\sffamily\small, \node[main node] (I) [below of=F] {I};
fill=white,inner sep=1pt}]
% Right-hand-side arrows rendered from top to bottom to \path[every node/.style={font=\sffamily\small,
% achieve proper rendering of labels over arrows. fill=white,inner sep=1pt}]
(M) edge [loop above] node {PrRd/-, PrWr/-} (M) % Right-hand-side arrows rendered from top to bottom to
edge [bend left=60] node[right=1mm] {BusRdX/Flush} (I) % achieve proper rendering of labels over arrows.
edge [bend left=40] node[right=1mm] {BusRd/Flush} (S) (M) edge [loop above] node {PrRd/-, PrWr/-} (M)
(E) edge [loop above] node {PrRd/-} (E) edge [bend left=60] node[right=1mm] {BusRdX/Flush} (I)
edge [bend left=50] node[right=1mm] {BusRdX/Flush} (I) edge [bend left=40] node[right=1mm] {BusRd/Flush} (S)
edge [bend left=30] node[right=1mm] {BusRd/Flush} (S) (E) edge [loop above] node {PrRd/-} (E)
(S) edge [loop above] node {PrRd/-} (S) edge [bend left=50] node[right=1mm] {BusRdX/Flush} (I)
edge [loop right] node[right=1mm] {BusRd/-} (S) edge [bend left=30] node[right=1mm] {BusRd/Flush} (S)
edge [bend left=40] node[right=1mm] {BusRdX/Flush} (I) (S) edge [loop above] node {PrRd/-} (S)
(F) edge [bend left=30] node[right=1mm] {BusRdX/Flush} (I) edge [loop right] node[right=1mm] {BusRd/-} (S)
% Left-hand-side arrows rendered from bottom to top to edge [bend left=40] node[right=1mm] {BusRdX/Flush} (I)
% achieve proper rendering of labels over arrows. (F) edge [bend left=30] node[right=1mm] {BusRdX/Flush} (I)
(I) edge [bend left=65] node[left=1mm] {PrWr/BusRdX} (M) % Left-hand-side arrows rendered from bottom to top to
edge [bend left=55] node[left=1mm] {PrRd/BusRd Ex} (E) % achieve proper rendering of labels over arrows.
edge [bend left=30] node[left=1mm] {PrRd/BusRd} (F) (I) edge [bend left=65] node[left=1mm] {PrWr/BusRdX} (M)
(F) edge [loop above] node {PrRd/-} (F) edge [bend left=55] node[left=1mm] {PrRd/BusRd Ex} (E)
edge [bend left=50] node[left=1mm] {PrWr/BusRdX} (M) edge [bend left=30] node[left=1mm] {PrRd/BusRd} (F)
edge [bend left=30] node[left=1mm] {BusRd/Flush} (S) (F) edge [loop above] node {PrRd/-} (F)
(S) edge [bend left=40] node[left=1mm] {PrWr/BusRdX} (M) edge [bend left=50] node[left=1mm] {PrWr/BusRdX} (M)
(E) edge [bend left=30] node[left=1mm] {PrWr/-} (M); edge [bend left=30] node[left=1mm] {BusRd/Flush} (S)
\end{tikzpicture} (S) edge [bend left=40] node[left=1mm] {PrWr/BusRdX} (M)
(E) edge [bend left=30] node[left=1mm] {PrWr/-} (M);
\end{tikzpicture}
\end{document} \end{document}
\ No newline at end of file
\documentclass[tikz, border=10pt]{standalone} \documentclass[tikz, border=10pt]{standalone}
% \usepackage{xcolor} \usepackage{tikz-timing}
% \definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784}% \usepackage{xcolor}
% \definecolor{bgred}{rgb}{1,0.61569,0.61569}% \definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784}
% \definecolor{fgblue}{rgb}{0,0,0.6}% \definecolor{bgred}{rgb}{1,0.61569,0.61569}
% \definecolor{fgred}{rgb}{0.6,0,0}% \definecolor{fgblue}{rgb}{0,0,0.6}
\definecolor{fgred}{rgb}{0.6,0,0}
\begin{document} \begin{document}
\begin{tikztimingtable}[timing/slope=0, \begin{tikztimingtable}[timing/slope=0,
......
% ----------------------------------------------------------------------------------------------------------------------------
% Input & Font Encoding
% ----------------------------------------------------------------------------------------------------------------------------
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
% ----------------------------------------------------------------------------------------------------------------------------
% Bibliography/References
% ----------------------------------------------------------------------------------------------------------------------------
% \RequirePackage{hyperref}
% ----------------------------------------------------------------------------------------------------------------------------
% Bibliography/References
% ----------------------------------------------------------------------------------------------------------------------------
\RequirePackage[square,numbers,sort]{natbib}
\bibliographystyle{IEEEtranSNC}
% ----------------------------------------------------------------------------------------------------------------------------
% Equations
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage{amsmath}
% ----------------------------------------------------------------------------------------------------------------------------
% Acronyms
% ----------------------------------------------------------------------------------------------------------------------------
% \RequirePackage[hyperref=true]{acro}
\RequirePackage{acro}
\RequirePackage{enumitem}
\acsetup{ first-long-format = \itshape }
\acsetup{ list-foreign-format = \itshape\acroenparen }
\newlist{acronyms}{description}{1}
\setlist[acronyms]{labelwidth = 5em}
\DeclareAcroListStyle{acrostyle}{list}{ list = acronyms }
\acsetup{ list-style = acrostyle }
\input{acronyms}
% ----------------------------------------------------------------------------------------------------------------------------
% Languagues
% ----------------------------------------------------------------------------------------------------------------------------
\RequirePackage[french,german,english]{babel}
% ----------------------------------------------------------------------------------------------------------------------------
% Units
% ----------------------------------------------------------------------------------------------------------------------------
\RequirePackage[binary-units]{siunitx}
\RequirePackage{xfrac}
\sisetup{quotient-mode=fraction,fraction-function=\sfrac,product-units=single,exponent-product=\times}
% ----------------------------------------------------------------------------------------------------------------------------
% Tables
% ----------------------------------------------------------------------------------------------------------------------------
\RequirePackage{booktabs,tabu}
\RequirePackage{multirow}
\RequirePackage{multicol}
% ----------------------------------------------------------------------------------------------------------------------------
% TikZ
% ----------------------------------------------------------------------------------------------------------------------------
\RequirePackage{tikz}
% ----------------------------------------------------------------------------------------------------------------------------
% Miscellaneous
% ----------------------------------------------------------------------------------------------------------------------------
\RequirePackage{blindtext}
\RequirePackage{fhtw}
\RequirePackage{graphicx}
\RequirePackage{textcomp}
% ----------------------------------------------------------------------------------------------------------------------------
% Colors
% ----------------------------------------------------------------------------------------------------------------------------
\RequirePackage{xcolor}
% TODO: provide examples
% \usepackage{usebib}
% \bibinput{references}
\documentclass{standalone} \documentclass{standalone}
% \usepackage{booktabs}
% \usepackage{tabu} \usepackage{booktabs,tabu,multirow,multicol,xfrac}
% \usepackage{multirow} \usepackage[binary-units]{siunitx}
% \usepackage{multicol} \sisetup{quotient-mode=fraction,fraction-function=\sfrac,product-units=single,exponent-product=\times}
% \usepackage{xfrac}
% \usepackage[binary-units]{siunitx}
% \sisetup{quotient-mode=fraction,fraction-function=\sfrac,product-units=single,exponent-product=\times}
\begin{document} \begin{document}
......
\documentclass{standalone} \documentclass{standalone}
% \usepackage{booktabs,tabu,multirow,multicol,xfrac}
% \usepackage[binary-units]{siunitx} \usepackage{booktabs,tabu,multirow,multicol,xfrac}
% \sisetup{quotient-mode=fraction,fraction-function=\sfrac,product-units=single,exponent-product=\times} \usepackage[binary-units]{siunitx}
% \usepackage{acro} \sisetup{quotient-mode=fraction,fraction-function=\sfrac,product-units=single,exponent-product=\times}
% \usepackage{enumitem}
% \acsetup{ first-long-format = \itshape } \usepackage{acro}
% \acsetup{ list-foreign-format = \itshape\acroenparen } \onlyifstandalone{\input{acronyms}}
% \newlist{acronyms}{description}{1}
% \setlist[acronyms]{labelwidth = 5em}
% \DeclareAcroListStyle{acrostyle}{list}{ list = acronyms }
% \acsetup{ list-style = acrostyle }
% \input{resources/latex/acronyms}
\begin{document} \begin{document}
\begin{tabu} to 2.5\linewidth {X[0.2,m]X[0.25,m]X[0.35,m]X[0.3,m]X[c,m]} \toprule \begin{tabu} to 2.5\linewidth {X[0.15,m]X[0.1,m]X[0.15,m]X[0.1,m]X[c,m]} \toprule
% \everyrow{\midrule} % \everyrow{\midrule}
\rowfont{\large\bfseries} \rowfont{\large\bfseries}
......
\makeatletter \def\input@path{{../}} \makeatother \documentclass[class=book,crop=false]{standalone}
\documentclass[demo.tex]{subfiles}
\usepackage{blindtext}
\usepackage{preamble}
\begin{document} \begin{document}
...@@ -7,16 +9,13 @@ ...@@ -7,16 +9,13 @@
\blindtext \blindtext
\section{First} \section{First}
\blindtext \blindtext[3]
\section{Second} \section{Second}
\blindtext \blindtext
\blindtext \blindtext[3]
\blindtext
\blindtext
\blindtext \blindtext[2]
\blindtext
\end{document} \end{document}
\ No newline at end of file
\makeatletter \def\input@path{{../}}\makeatother \documentclass[class=book,crop=false]{standalone}
\documentclass[demo.tex]{subfiles}
% \usepackage[class=book]{standalone} \usepackage[subpreambles,sort]{standalone}
% \usepackage[subpreambles]{standalone} \usepackage{preamble}
\usepackage[graphicx]{realboxes}
\begin{document} \begin{document}
...@@ -10,6 +11,7 @@ ...@@ -10,6 +11,7 @@
This chapter provides examples on This chapter provides examples on
\begin{itemize} \begin{itemize}
\item Equations (cf. Section \ref{sec:equation})
\item Acronyms (cf. Section \ref{sec:acronyms}) \item Acronyms (cf. Section \ref{sec:acronyms})
\item References (cf. Section \ref{sec:references}) \item References (cf. Section \ref{sec:references})
\item Textual: \item Textual:
...@@ -25,6 +27,34 @@ ...@@ -25,6 +27,34 @@
\item and many more. \item and many more.
\end{itemize} \end{itemize}
\section{Equations}\label{sec:equation}
\begin{equation} \label{eq:first}
a = bq + r
\end{equation}
where \eqref{eq:first} is true if $a$ and $b$ are integers with $b \neq c$.
\begin{subequations}
Maxwell's equations:
\begin{align}
B'&=-\nabla \times E,\\
E'&=\nabla \times B - 4\pi j,
\end{align}
\end{subequations}
\begin{figure}
\begin{equation}
\oint_C {E \cdot d\ell = - \frac{d}{{dt}}} \int_S {B_n dA}
\end{equation}
\caption{Maxwell's equation - Faraday's law}
\end{figure}
\begin{equation}
\forall x \in X, \quad \exists y \leq \epsilon
\end{equation}
\section{Acronyms}\label{sec:acronyms} \section{Acronyms}\label{sec:acronyms}
\ac{ES}-style beamer template of \acs{UAS} Technikum Wien. \ac{ES}-style beamer template of \acs{UAS} Technikum Wien.
...@@ -76,8 +106,8 @@ ...@@ -76,8 +106,8 @@
\section{Figures}\label{sec:figures} \section{Figures}\label{sec:figures}
See illustration (Figure \ref{fig:dilbert1}), TikZ example (Figure \ref{fig:mesif}), \texttt{timingtable} (\ref{fig:timingtable}), See illustration (Figure \ref{fig:dilbert1}), TikZ example (Figure \ref{fig:mesif}), \texttt{timingtable}
and another TikZ example (Figure \ref{fig:control-system}). (\ref{fig:timingtable}), and another TikZ example (Figure \ref{fig:control-system}).