diff --git a/CHANGELOG.md b/CHANGELOG.md index 349abdcb4d0c90e7b2f297e3542f7f8fb76517f3..da7a9b05be5850cb7a7dfe4719d09420c99f8d44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ All notable changes to this project will be documented in this file. - autobobble option for `listings`, which automaticly determins the indentation width and gooble it up, removing the need to put `gobble=n` manually every time. (#8) +- `todos` class-option. Loads the `todos` package if present but also redefines its commands to have no effect when this option is omitted. Also + changes the margins to make space for the todo-notes. ### Changed diff --git a/HsH-classes.dtx b/HsH-classes.dtx index f18773fb355dc26b39ac0d767bc78e9fea2718f8..aff7dec18bb7555fbfbc3f8a95ab82a9806d5ec6 100644 --- a/HsH-classes.dtx +++ b/HsH-classes.dtx @@ -29,6 +29,7 @@ \newcommand{\HsHlogoPage}{1} \newcommand{\includeHsHlogohere}[1][5cm]{\includegraphics[width=#1,page=\HsHlogoPage]{\HsHlogoPath}} \newif\if@german% +%<article|report>\newif\if@todos\@todosfalse% %% document options ------------------------------------------------------------------------------- \DeclareOption{german}{ @@ -61,6 +62,11 @@ \DeclareOption{roman}{ \renewcommand{\familydefault}{\rmdefault} } +%<*article|report> +\DeclareOption{todos}{ + \@todostrue +} +%</article|report> %<article>\DeclareOption*{\expandafter\PassOptionsToClass\expandafter{\CurrentOption}{scrartcl}} %<report>\DeclareOption*{\expandafter\PassOptionsToClass\expandafter{\CurrentOption}{scrreprt}} %<standalone>\DeclareOption*{\expandafter\PassOptionsToClass\expandafter{\CurrentOption}{standalone}} @@ -98,7 +104,11 @@ % %<*article|report> % required for changing layout -\PassOptionsToPackage{left=3cm,right=2.5cm,top=3cm,bottom=3cm}{geometry} +\if@todos + \PassOptionsToPackage{left=1cm,right=5cm,top=3cm,bottom=3cm}{geometry} +\else + \PassOptionsToPackage{left=3cm,right=2.5cm,top=3cm,bottom=3cm}{geometry} +\fi \RequirePackage{geometry} % % language specific localisation @@ -129,6 +139,23 @@ % this makes quotationmarks usable in text: \MakeOuterQuote{"} % +% Todonote package +% already changed the margins with geometry +\if@todos + \PassOptionsToPackage{svgnames}{xcolor} + \PassOptionsToPackage{ + textwidth=4.5cm, + textsize=small, + figwidth=.6\textwidth + }{todonotes} + \RequirePackage{todonotes} + \setlength{\marginparwidth}{5.2cm} +\else + \newcommand{\listoftodos}[1][]{} + \newcommand{\todo}[2][]{} + \newcommand{\missingfigure}[2][]{} +\fi +% % foreach loops \RequirePackage{pgffor} % @@ -642,6 +669,13 @@ isbn=false, } }{} +\@ifpackageloaded{todonotes}{ + \setuptodonotes{ + backgroundcolor=orange!60!white, + linecolor=orange, + bordercolor=white + } +}{} \@ifpackageloaded{siunitx}{ \if@german \sisetup{output-decimal-marker={,}} % use comma as dezimal diff --git a/README.md b/README.md index 2477cc9a4454759ed77756d8ecbbbf24331975da..9af97c9361b68771c725ab10be91f6fef3d77f22 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,9 @@ If you don't define something different, the classes set your project up to use keep the page numbering consistent with the original. - `sans` This option sets the font family to Sans Serif. - `roman` The opposite of `sans`, sets a roman/serif font. +- `todos` This enables the [`todonotes`](http://tug.ctan.org/macros/latex/contrib/todonotes/todonotes.pdf) package and allows you to use the `\todo{}` + command. It is set up in a way that removing this option allows you to still leave `\todos`'s in your code without breaking. DO NOT combine this + with the `twoside` option! All remaining options are passed along to the respective subclasses and processed there. This means, that you can use all the options described in their respecĀtive documentations. diff --git a/src/HsH-article.cls b/src/HsH-article.cls index af8be928a1b28040574da73f9e4f06cdca215eb7..6c709cbfea2c72b1204bf853542a6c9af3a92075 100644 --- a/src/HsH-article.cls +++ b/src/HsH-article.cls @@ -30,6 +30,7 @@ \newcommand{\HsHlogoPage}{1} \newcommand{\includeHsHlogohere}[1][5cm]{\includegraphics[width=#1,page=\HsHlogoPage]{\HsHlogoPath}} \newif\if@german% +\newif\if@todos\@todosfalse% %% document options ------------------------------------------------------------------------------- \DeclareOption{german}{ @@ -62,6 +63,9 @@ \DeclareOption{roman}{ \renewcommand{\familydefault}{\rmdefault} } +\DeclareOption{todos}{ + \@todostrue +} \DeclareOption*{\expandafter\PassOptionsToClass\expandafter{\CurrentOption}{scrartcl}} \ExecuteOptions{fontsize=11pt,a4paper,ngerman,sans} % default options \ProcessOptions\relax @@ -78,7 +82,11 @@ \RequirePackage{graphicx} \RequirePackage{amsmath} \if@german\RequirePackage{ziffer}\fi -\PassOptionsToPackage{left=3cm,right=2.5cm,top=3cm,bottom=3cm}{geometry} +\if@todos + \PassOptionsToPackage{left=1cm,right=5cm,top=3cm,bottom=3cm}{geometry} +\else + \PassOptionsToPackage{left=3cm,right=2.5cm,top=3cm,bottom=3cm}{geometry} +\fi \RequirePackage{geometry} \if@german\PassOptionsToPackage{ngerman}{babel}\else\PassOptionsToPackage{english}{babel}\fi \RequirePackage{babel} @@ -94,6 +102,20 @@ \if@german\PassOptionsToPackage{german=quotes}{csquotes}\fi \RequirePackage{csquotes} \MakeOuterQuote{"} +\if@todos + \PassOptionsToPackage{svgnames}{xcolor} + \PassOptionsToPackage{ + textwidth=4.5cm, + textsize=small, + figwidth=.6\textwidth + }{todonotes} + \RequirePackage{todonotes} + \setlength{\marginparwidth}{5.2cm} +\else + \newcommand{\listoftodos}[1][]{} + \newcommand{\todo}[2][]{} + \newcommand{\missingfigure}[2][]{} +\fi \RequirePackage{pgffor} %% options for not loaded packages ---------------------------------------------------------------- \PassOptionsToPackage{backend=biber,style=alphabetic,sorting=nyt}{biblatex} diff --git a/src/HsH-report.cls b/src/HsH-report.cls index ac8a96207059ad94f12c68ef0f531e5871d107d8..137883733e05d279248c2e61841674501685b426 100644 --- a/src/HsH-report.cls +++ b/src/HsH-report.cls @@ -30,6 +30,7 @@ \newcommand{\HsHlogoPage}{1} \newcommand{\includeHsHlogohere}[1][5cm]{\includegraphics[width=#1,page=\HsHlogoPage]{\HsHlogoPath}} \newif\if@german% +\newif\if@todos\@todosfalse% %% document options ------------------------------------------------------------------------------- \DeclareOption{german}{ @@ -62,6 +63,9 @@ \DeclareOption{roman}{ \renewcommand{\familydefault}{\rmdefault} } +\DeclareOption{todos}{ + \@todostrue +} \DeclareOption*{\expandafter\PassOptionsToClass\expandafter{\CurrentOption}{scrreprt}} \ExecuteOptions{fontsize=11pt,a4paper,ngerman,sans} % default options \ProcessOptions\relax @@ -78,7 +82,11 @@ \RequirePackage{graphicx} \RequirePackage{amsmath} \if@german\RequirePackage{ziffer}\fi -\PassOptionsToPackage{left=3cm,right=2.5cm,top=3cm,bottom=3cm}{geometry} +\if@todos + \PassOptionsToPackage{left=1cm,right=5cm,top=3cm,bottom=3cm}{geometry} +\else + \PassOptionsToPackage{left=3cm,right=2.5cm,top=3cm,bottom=3cm}{geometry} +\fi \RequirePackage{geometry} \if@german\PassOptionsToPackage{ngerman}{babel}\else\PassOptionsToPackage{english}{babel}\fi \RequirePackage{babel} @@ -94,6 +102,20 @@ \if@german\PassOptionsToPackage{german=quotes}{csquotes}\fi \RequirePackage{csquotes} \MakeOuterQuote{"} +\if@todos + \PassOptionsToPackage{svgnames}{xcolor} + \PassOptionsToPackage{ + textwidth=4.5cm, + textsize=small, + figwidth=.6\textwidth + }{todonotes} + \RequirePackage{todonotes} + \setlength{\marginparwidth}{5.2cm} +\else + \newcommand{\listoftodos}[1][]{} + \newcommand{\todo}[2][]{} + \newcommand{\missingfigure}[2][]{} +\fi \RequirePackage{pgffor} %% options for not loaded packages ---------------------------------------------------------------- \PassOptionsToPackage{backend=biber,style=alphabetic,sorting=nyt}{biblatex} diff --git a/src/config.tex b/src/config.tex index 4c891fceaf56eaecd00134d7727840aeec45d138..59d28f2e02e07f1aa05bf6d525a0cb3bdf1e7fd7 100644 --- a/src/config.tex +++ b/src/config.tex @@ -17,6 +17,13 @@ isbn=false, } }{} +\@ifpackageloaded{todonotes}{ + \setuptodonotes{ + backgroundcolor=orange!60!white, + linecolor=orange, + bordercolor=white + } +}{} \@ifpackageloaded{siunitx}{ \if@german \sisetup{output-decimal-marker={,}} % use comma as dezimal diff --git a/test.pdf b/test.pdf index b9e4e8c9d6eb2d9b624a1e7b368ea5c20ad43b1a..fb41c150782f1a49963e3c7b3cc3d14a8f52d304 100644 Binary files a/test.pdf and b/test.pdf differ diff --git a/test.tex b/test.tex index 34b7ff10b03bba083e371fbe6236f4095368c4e0..86e2ee9b25f4e3bbe763b8621a929638952f28ef 100644 --- a/test.tex +++ b/test.tex @@ -1,4 +1,4 @@ -\documentclass[twoside,f1]{HsH-report} +\documentclass[todos,f1]{HsH-report} \usepackage{color} \usepackage{lipsum} @@ -58,7 +58,7 @@ \vspace{2cm}\\ eine zahl: $3,5+3.5$\footnote[1]{hello}\\ - Tiny: {\tiny hello} Small: {\small hello} + Tiny: {\tiny hello} \todo{test} Small: {\small hello} \makeatletter \newcommand{\test}[1][l]{ @@ -70,7 +70,7 @@ \fi } } - \test; \test[right] + \test; \test[right] \todo{super long todo that mus be going over multiple lines} \lipsum[5-6] @@ -78,9 +78,11 @@ \begin{figure} \centering \includegraphics[width=0.6\textwidth, page=2]{plt/examplePlot.pdf} - \caption{a nice plot} + \caption{a nice plot } \end{figure} + test text\todo{why this?} + \begin{figure} \centering \includegraphics{crc/exampleCircuit.pdf}