diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-09-03 22:03:47 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-09-03 22:03:47 +0200 |
commit | 7e6e73b123d741eb419e3391fb27c2cc00271bac (patch) | |
tree | fbfaa94f0071349ff49f63e51c651dbf890d1766 | |
parent | f5da5d0d5489481ddb18dcb6088059884efeb024 (diff) |
add more cruft
-rw-r--r-- | contributing.md | 46 | ||||
-rw-r--r-- | example.tex | 63 | ||||
-rw-r--r-- | img/theme.ipuml | 5 | ||||
-rw-r--r-- | latexmkrc | 4 | ||||
-rw-r--r-- | makefile | 11 | ||||
-rw-r--r-- | meta.tex | 2 | ||||
-rw-r--r-- | plan.tex | 2 | ||||
-rw-r--r-- | projdoc.cls | 108 | ||||
-rw-r--r-- | readme.md | 4 |
9 files changed, 196 insertions, 49 deletions
diff --git a/contributing.md b/contributing.md index 891b104..ab14b71 100644 --- a/contributing.md +++ b/contributing.md @@ -1,13 +1,55 @@ +This document is an extension of the [crêpe engine contribution +guidelines][crepe-engine-contrib]. Rules in this document override those in the +other document. + +# Versioning + +- TODO: discuss w/ group + # Code style - Indent using tabs - Wrap long lines at column 80 - Diacritical marks should be represented in ASCII using LaTeX syntax instead of using UTF-8 (i.e. `fa\c{c}ade` instead of `façade`) -- Images should be placed in the [img/](./img/) folder +- Images should be placed in the img/ folder +- Labels and bibliography keys should only consist of characters from the + following set: `[a-z0-9:-]` (lower-case, numbers, colon, dash). + +# References + +References are used in the LaTeX source code, and should be recognizable +without having to compile the document first. Reference names should be short +and descriptive, so avoid referring to generated numbers (i.e. +`sec:release-cycle` instead of `sec:1.2.3`) or arbitrary info such as publish +year (i.e. `book:struct-comp-org` instead of `TanenbaumAustin12`). + +## Labels + +Please use prefixes to 'namespace' `\label`s: + +|type|prefix| +|-|-| +|Figures|`fig:`| +|Tables|`tab:`| +|Sections|`sec:`| +|List items (i.e. `enumerate`/`itemize`)|`item:`| + +## Sources + +Bibliography entries work with a similar label system (usually called *keys*). +Since these exist in a registry separate from `\label` entries, these do not +need to be prefixed. + +For consistency, the following format is preferred: `authority:topic`. The +`authority` part refers to a company, website or author, and `topic` refers to +a title, chip model number, etc. depending on the type of document being +referenced. <!-- TODO -- Cross-references and citations should be handled using smartref +- Cross-references and citations should be handled using cleveref --> +[crepe-engine-contrib]: https://github.com/lonkaars/crepe/blob/master/contributing.md + diff --git a/example.tex b/example.tex new file mode 100644 index 0000000..843cf38 --- /dev/null +++ b/example.tex @@ -0,0 +1,63 @@ +\documentclass{projdoc} +\input{meta.tex} + +\title{Example Document} + +\begin{document} + +% generate table of contents, list of figures and list of tables +\tablestables + +\bigskip +Look how nice and consistent these tables and lists look compared to the default in +MS Word! + +% flush page +\newpage + +\section{Introduction} + +This is an example document that is meant to demonstrate various \LaTeX{} features, +as well as some macros specific to \hbox{projdoc.cls}. +% LaTeX has automatic line breaking. \hbox is used here to ensure projdoc.cls is +% never broken across lines. + +\section{Sectioning} +\subsection{Subsections} +\subsubsection{Subsubsections} +\paragraph{Paragraphs (level 4)} + +These don't show up in the table of contents by default + +\section{Figures and tables} + +\Cref{fig:example-a} definitely shows something. + +\begin{figure} + \centering + \includegraphics[width=8cm]{example-image-a} + \label{fig:example-a} + \caption{This is the figure title} +\end{figure} + +\begin{table} + \centering + % i know, table code sucks + \begin{tabular}{ll@{\qquad}r} + \toprule + $a$ & $b$ & $x$\\ + \midrule + 0 & 0 & 0\\ + 0 & 1 & 1\\ + 1 & 0 & 1\\ + 1 & 1 & 0\\ + \bottomrule + \end{tabular} + % booktabs tables look very nice, but it seems the author hates vertical rules with + % a burning passion. please avoid using vertical rules for consistency. + \label{tab:gate-xor} + \caption{XOR-gate truth table} +\end{table} + +\end{document} + diff --git a/img/theme.ipuml b/img/theme.ipuml new file mode 100644 index 0000000..88d183a --- /dev/null +++ b/img/theme.ipuml @@ -0,0 +1,5 @@ +!theme plain +skinparam DefaultFontSize 14 +skinparam DefaultFontName Inter +skinparam RoundCorner 0 +skinparam maxMessageSize 200 diff --git a/latexmkrc b/latexmkrc new file mode 100644 index 0000000..ad6c178 --- /dev/null +++ b/latexmkrc @@ -0,0 +1,4 @@ +$pdflatex = "xelatex %O %S"; +$pdf_mode = 1; +$dvi_mode = 0; +$postscript_mode = 0; @@ -0,0 +1,11 @@ +all: plan.pdf + +LATEXMKFLAGS += -cd +LATEXMKFLAGS += -interaction=nonstopmode +%.pdf: %.tex + -latexmk $(LATEXMKFLAGS) $< + +%.puml.pdf: %.puml + plantuml -tpdf $< + mv $*.pdf $@ + @@ -1,5 +1,5 @@ \organization{Avans University of Applied Sciences} -\project{PROJECT NAME} +\project{Project cr\^epe} \version{0.0} \author{% Loek Le Blansch\and% @@ -1,5 +1,5 @@ \documentclass{projdoc} -\include{meta.tex} +\input{meta.tex} \title{Project Plan} diff --git a/projdoc.cls b/projdoc.cls index c1865ec..4d4f3b8 100644 --- a/projdoc.cls +++ b/projdoc.cls @@ -10,6 +10,8 @@ % confusing to acrobat/firefox users \PassOptionsToPackage{hidelinks}{hyperref} \PassOptionsToPackage{english}{babel} +\PassOptionsToPackage{noabbrev}{cleveref} +\PassOptionsToPackage{nosort}{cleveref} % frequently used packages \RequirePackage{geometry} @@ -24,10 +26,16 @@ \RequirePackage{needspace} \RequirePackage{hyperref} \RequirePackage{microtype} -\RequirePackage{smartref} +\RequirePackage{xcolor} +\RequirePackage{etoolbox} +\RequirePackage{graphicx} +\RequirePackage{unicode-math} +\RequirePackage{amsmath} +\RequirePackage{cleveref} % font style \setmainfont{TeX Gyre Schola} +\setmathfont{TeX Gyre Schola Math} \setmonofont[Scale=0.85]{JetBrainsMono Nerd Font} % fix fonts w/ siunitx @@ -46,51 +54,49 @@ \def\organization#1{\def\@organization{#1}} \let\@version\relax \def\version#1{\def\@version{#1}} -\def\@maketitle{ - \centering - \vspace*{2in} - { - { - \bfseries\Huge - \strut\@title\strut - }\\% no parskip - { - \Large - \strut\@project\strut - } - } - - \vspace{1in} - - { - { - \def\and{\par} - \parskip=0.5ex - \strut\@author\strut - } - - \vspace{2em} - - {\strut\@organization\strut} - } - - \vfill - \flushright - - { - { - \strut{}Version \@version\strut - } - - { - \strut\@date\strut - } - } - - \vspace*{2in} +\def\@maketitle{% + \centering% + \parskip=0pt% + \vspace*{2in}% + \par{% + \par{% + \bfseries\Huge% + \strut\@title\strut% + }% + \par{% + \Large% + \strut\@project\strut% + }% + }% + \vspace{1in}% + \par{% + \par{% + \def\and{\par}% + \parskip=0.5ex% + \strut\@author\strut% + }% + \vspace{2em}% + \par{% + \footnotesize\itshape% + \strut\@organization\strut% + }% + }% + \vfill\flushright% + \par{% + \par{\strut{}Version \@version\strut}% + \par{\strut\@date\strut}% + }% + \par\vspace*{2in}% } \makeatother +% float here by default +\usepackage{float} +\makeatletter +\def\fps@figure{H} +\def\fps@table{H} +\makeatother + % always start with title page \AtBeginDocument{ \clearpage @@ -100,3 +106,19 @@ \end{titlepage} } +% store figure/table count in macros +\makeatletter +\AtEndDocument{ + \immediate\write\@mainaux{\string\global\string\def\string\figurecount{\the\value{figure}}} + \immediate\write\@mainaux{\string\global\string\def\string\tablecount{\the\value{table}}} + \immediate\write\@mainaux{\string\global\string\def\string\pagecount{\thepage}} +} +\makeatother + +% generate table of contents, figures, tables +\def\tablestables{% + \tableofcontents% + \ifnumgreater{\figurecount}{0}{\listoffigures}{}% + \ifnumgreater{\tablecount}{0}{\listoftables}{}% +} + @@ -1,6 +1,6 @@ -# Docs +# crêpe docs -Project documentation in LaTeX format +systems programming in c++ minor project documentation Please see [style.md](./style.md) for writing style and [contributing.md](./contributing.md) for coding and git standards. |