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 -*-
# latexmkrc
$builddir = $ENV{'BUILDDIR'};
$depsfile = $ENV{'DEPSFILE'};
$recorder = 1;
$pdf_mode = 1;
$bibtex_use = 2;
......@@ -7,8 +10,9 @@ $force_mode = 1;
$dependents_list = 1;
$silence_logfile_warnings = 0;
$use_make_for_missing_files = 1;
$out_dir = $ENV{'BUILDDIR'};
$deps_file = "$out_dir/$ENV{'TARGET'}.deps";
$out_dir = $builddir;
$deps_file = "$out_dir/$depsfile.deps";
print $deps_file;
@BIBINPUTS = ('.',$ENV{'BIBDIRS'});
$pdflatex = 'pdflatex %O -interaction=nonstopmode -synctex=1 -file-line-error %S';
......
BASENAME = demo
BUILDDIR = build
# Environment
TEXDIRS = resources/tex:resources/latex-sty:resources/listings:resources/latex:resources/images:resources/tables:resources/latex:resources/figures
# environment
TEXDIRS = resources/tex:resources/latex-sty:resources/listings:resources/latex
TEXDIRS := $(TEXDIRS):resources/images:resources/tables:resources/latex
TEXDIRS := $(TEXDIRS):resources/figures
BIBDIRS = resources/latex/
BSTDIR = resources/latex-bst/
# cf. latexmkrc
LATEXMKS = export TARGET=$(basename $(notdir $1)).pdf && $(call LATEXMK, $(basename $1)$2)
LATEXMK = latexmk $1
LATEXMK = latexmk $(OPTS)$1
VIEWER = xdg-open
# main targets
all: $(BASENAME).build
view: $(BASENAME).view
preview: $(BASENAME).preview
clean: $(BASENAME).clean
distclean: $(BASENAME).distclean
LATEXMK_COND = @export DEPSFILE=$(notdir $(basename $(TARGET))) && \
$(if $(strip $(TARGET)), \
$(call LATEXMK, $(basename $(TARGET))$1), \
$(call LATEXMK, $(BASENAME)$1) \
&& echo '' && echo $(INSTRUCTIONS))
# dynamic targets
%.build:
$(call LATEXMKS, $@, )
LATEXMK_ERRS = $(if $(strip $1), \
$(call LOG, $(BUILDDIR)/$(basename $1).log), \
$(call LOG, $(BUILDDIR)/$(basename $(BASENAME)).log) \
)
%.view:
$(call LATEXMKS, $@, -pv)
all: build
%.preview:
$(call LATEXMKS, $@, -pvc)
build: setup
$(call LATEXMK_COND, )
%.clean:
$(call LATEXMKS, $@, -c)
log:
$(call LATEXMK_ERRS, $(TARGET))
%.distclean:
$(call LATEXMKS, $@, -C)
view: setup
$(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 $@
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
# Export all variables by default
# export all variables by default
.EXPORT_ALL_VARIABLES:
TEXINPUTS := :.:$(TEXDIRS)
# bibtex invoked from BUILDDIR, thus prepend './../'
BSTINPUTS := ./../$(BSTDIR)
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:
MAKEFLAGS += --no-builtin-rules
\ No newline at end of file
No preview for this file type
......@@ -4,75 +4,7 @@
% Document Setup
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage[subpreambles,sort]{standalone}
\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}
\usepackage{preamble}
% ----------------------------------------------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------------------------------------------
......@@ -95,17 +27,17 @@
% ------------------------------------------------------------------------------------------------------------------------
% Chapter 01
% ------------------------------------------------------------------------------------------------------------------------
\subfile{chapter01}
\input{chapter01}
% ------------------------------------------------------------------------------------------------------------------------
% Chapter 02
% ------------------------------------------------------------------------------------------------------------------------
\subfile{chapter02}
\input{chapter02}
% ------------------------------------------------------------------------------------------------------------------------
% Chapter 03
% ------------------------------------------------------------------------------------------------------------------------
\subfile{chapter03}
\input{chapter03}
% ------------------------------------------------------------------------------------------------------------------------
% Bibliography/References
......
\documentclass[tikz, border=10pt]{standalone}
% \usetikzlibrary{arrows}
% \usetikzlibrary{shapes}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\begin{document}
......
% Author: Marek Fiser <tikz at marekfiser.cz>
% MESIF protocol: http://en.wikipedia.org/wiki/MESIF_protocol
\documentclass[tikz, border=10pt]{standalone}
% \usetikzlibrary{arrows}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,fill=blue!20,draw,
font=\sffamily\Large\bfseries,minimum size=15mm}]
\begin{tikzpicture}[
->,>=stealth',shorten >=1pt,auto,node distance=3cm,thick,
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] (S) [below of=E] {S};
\node[main node] (F) [below of=S] {F};
\node[main node] (I) [below of=F] {I};
\path[every node/.style={font=\sffamily\small,
fill=white,inner sep=1pt}]
% Right-hand-side arrows rendered from top to bottom to
......@@ -35,5 +39,6 @@
edge [bend left=30] node[left=1mm] {BusRd/Flush} (S)
(S) edge [bend left=40] node[left=1mm] {PrWr/BusRdX} (M)
(E) edge [bend left=30] node[left=1mm] {PrWr/-} (M);
\end{tikzpicture}
\end{tikzpicture}
\end{document}
\ No newline at end of file
\documentclass[tikz, border=10pt]{standalone}
% \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}%
\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}
\begin{document}
\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}
% \usepackage{booktabs}
% \usepackage{tabu}
% \usepackage{multirow}
% \usepackage{multicol}
% \usepackage{xfrac}
% \usepackage[binary-units]{siunitx}
% \sisetup{quotient-mode=fraction,fraction-function=\sfrac,product-units=single,exponent-product=\times}
\usepackage{booktabs,tabu,multirow,multicol,xfrac}
\usepackage[binary-units]{siunitx}
\sisetup{quotient-mode=fraction,fraction-function=\sfrac,product-units=single,exponent-product=\times}
\begin{document}
......
\documentclass{standalone}
% \usepackage{booktabs,tabu,multirow,multicol,xfrac}
% \usepackage[binary-units]{siunitx}
% \sisetup{quotient-mode=fraction,fraction-function=\sfrac,product-units=single,exponent-product=\times}
% \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{resources/latex/acronyms}
\usepackage{booktabs,tabu,multirow,multicol,xfrac}
\usepackage[binary-units]{siunitx}
\sisetup{quotient-mode=fraction,fraction-function=\sfrac,product-units=single,exponent-product=\times}
\usepackage{acro}
\onlyifstandalone{\input{acronyms}}
\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}
\rowfont{\large\bfseries}
......
\makeatletter \def\input@path{{../}} \makeatother
\documentclass[demo.tex]{subfiles}
\documentclass[class=book,crop=false]{standalone}
\usepackage{blindtext}
\usepackage{preamble}
\begin{document}
......@@ -7,16 +9,13 @@
\blindtext
\section{First}
\blindtext
\blindtext[3]
\section{Second}
\blindtext
\blindtext
\blindtext
\blindtext
\blindtext[3]
\blindtext
\blindtext
\blindtext[2]
\end{document}
\ No newline at end of file
\makeatletter \def\input@path{{../}}\makeatother
\documentclass[demo.tex]{subfiles}
% \usepackage[class=book]{standalone}
% \usepackage[subpreambles]{standalone}
\documentclass[class=book,crop=false]{standalone}
\usepackage[subpreambles,sort]{standalone}
\usepackage{preamble}
\usepackage[graphicx]{realboxes}
\begin{document}
......@@ -10,6 +11,7 @@
This chapter provides examples on
\begin{itemize}
\item Equations (cf. Section \ref{sec:equation})
\item Acronyms (cf. Section \ref{sec:acronyms})
\item References (cf. Section \ref{sec:references})
\item Textual:
......@@ -25,6 +27,34 @@
\item and many more.
\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}
\ac{ES}-style beamer template of \acs{UAS} Technikum Wien.
......@@ -76,8 +106,8 @@
\section{Figures}\label{sec:figures}
See illustration (Figure \ref{fig:dilbert1}), TikZ example (Figure \ref{fig:mesif}), \texttt{timingtable} (\ref{fig:timingtable}),
and another TikZ example (Figure \ref{fig:control-system}).
See illustration (Figure \ref{fig:dilbert1}), TikZ example (Figure \ref{fig:mesif}), \texttt{timingtable}
(\ref{fig:timingtable}), and another TikZ example (Figure \ref{fig:control-system}).
\begin{figure}
\centering
......@@ -91,22 +121,24 @@
\begin{figure}
\centering
\resizebox {0.75\textwidth} {!} {\input{mesif}}
% \input{mesif}
% \resizebox {0.75\textwidth} {!} {\input{mesif}}
\input{mesif}
\caption{MESIF protocol, \textcopyright~Marek Fiser, marekfiser.cz}
\label{fig:mesif}
\end{figure}
\begin{figure}
\centering
\resizebox {0.65\textwidth} {!} {\input{timingtable}}
% \resizebox {0.65\textwidth} {!} {\input{timingtable}}
\input{timingtable}
\caption{SR flip-flop timing diagram}% (provided by the \texttt{timingtable} package)}
\label{fig:timingtable}
\end{figure}
\begin{figure}
\centering
\resizebox {0.75\textwidth} {!} {\input{control-system}}
% \resizebox {0.75\textwidth} {!} {\input{control-system}}
\input{control-system}
\caption{Control system principle} %, http://www.texample.net/tikz/examples/control-system-principles/}
\label{fig:control-system}
\end{figure}
......@@ -120,22 +152,27 @@
\section{Tables}\label{sec:tables}
See simple table (Table \ref{tab:table1}, and more advanced, rotated example table (Table \ref{tab:table2})).
See simple table (Table \ref{tab:table1}, and more advanced, rotated example table (Table
\ref{tab:table2})).
\begin{table}
\centering\scriptsize
\resizebox {\textwidth} {!} {\input{bandgab}}
\centering
% \resizebox {\textwidth} {!} {\input{bandgab}}
\input{bandgab}
\caption{The bandgab of some semiconductors.}
\label{tab:table1}
\end{table}
\begin{table}
\centering\scriptsize
\Rotatebox{90}{\resizebox {1.4\textwidth} {!} {\input{siunits}}}
\centering
\Rotatebox{90}{\resizebox {1.5\textwidth} {!} {\input{siunits}}}
\caption{\acs{SI} base units}
\label{tab:table2}
\end{table}
\cleardoublepage
% \biblio{}
\bibliolist{}
......
\makeatletter \def\input@path{{../}} \makeatother
\documentclass[demo.tex]{subfiles}
\documentclass[class=book,crop=false]{standalone}
\usepackage{blindtext}
\usepackage{preamble}
\begin{document}
\chapter{R{\'e}sum{\'e}}
\blindtext
\blindtext[2]
\section{First}
\blindtext
\blindtext[3]
\section{Second}
\blindtext
\blindtext
\blindtext
\blindtext
\blindtext[3]
\blindtext
\blindtext
\blindtext[2]
\end{document}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment