todonotes: [inline] anzeigen, alle anderen ausblenden

Redefinition von Makros, Definition eigener Befehle sowie neuer Umgebungen


OKraftDD
Forum-Newbie
Forum-Newbie
Beiträge: 2
Registriert: Di 12. Jan 2016, 23:09

todonotes: [inline] anzeigen, alle anderen ausblenden

Beitrag von OKraftDD »

Hallo Zusammen,

ich verwende das Todo-Paket
\usepackage{todonotes}
bei die Erstellung meiner Thesis.

Funktioniert soweit alles erst mal wunderbar.
\todo[inline]{Todo 1: Kommentare/ Todos zum Status - für Prof. / Lektor relevant}
\todo{Todo 2: Kommentare für den internen Gebrauch, also nur mich}
Nun möchte ich gern beim Generieren des Dokuments temporär die Todos der Kategorie 2 ausblenden, ohne alle Todos einzeln anfassen zu müssen. Da geht doch bestimmt etwas mit
\newcommand{}[]{}
oder?

Hier noch ein Minimalbeispiel:
\documentclass[%
]{scrreprt}

\usepackage{blindtext}  %lorem ipsum
\usepackage[colorinlistoftodos, ngerman]{todonotes}

\begin{document}

% list of todos
\listoftodos{}

% lorem ipsum
\blindtext
%Todo #1: comments/ todos about status for professor or lecture
\todo[inline]{Todo \#1: comments/ todos about status for professor or lecture}
% lorem ipsum
\blindtext
%Todo #2: comments for internal use. Just for me.
\todo{Todo \#2: comments for internal use. Just for me.}
% lorem ipsum
\blindtext

\end{document}
Bitte seid so nett und helft mir.

Danke euch!

OKraftDD

---

Das selbe Thema in einem anderen Forum: http://tex.stackexchange.com/questions/ ... all-others
---

Ich nutze: Mac OS X (Yosemite V10.10.5), Texpad V1.7.21), MacTex

OKraftDD
Forum-Newbie
Forum-Newbie
Beiträge: 2
Registriert: Di 12. Jan 2016, 23:09

Beitrag von OKraftDD »

Mir wurde geholfen:

You can have a look at the source code of the todonotes packages here on Github. In the file todonotes.dtx, on line 1618, todonotes defines the command \@todonotes@drawMarginNoteWithLine which prints the non-inline note. A simple way to remove all non-inline notes is to redefine this command to do nothing:
% Don't print any [non-inline] notes
\makeatletter
\renewcommand{\@todonotes@drawMarginNoteWithLine}{}
\makeatother
There is one problem with this approach: The ToDo note is still shown in the List of ToDo's. The command which adds items to the List of ToDo's is defined on lines 1649ff. To remove the non-inline notes, you can add an \if clause, which checks whether the current ToDo note is [inline] or not, and only call the command if it is inline:
% Remove [non-inline] notes from List of Todo's
\makeatletter
\renewcommand{\@todonotes@addElementToListOfTodos}{%
    % New: check if note is [inline]
    \if@todonotes@inlinenote%
    % if yes: print!, if no: do nothing
    \if@todonotes@colorinlistoftodos%
    \addcontentsline{tdo}{todo}{%
        \fcolorbox{\@todonotes@currentbordercolor}%
        {\@todonotes@currentbackgroundcolor}%
        {\textcolor{\@todonotes@currentbackgroundcolor}{o}}%
        \ \@todonotes@caption}%
    \else%
    \addcontentsline{tdo}{todo}{\@todonotes@caption}%
    \fi%
    \else%
    \fi}%
\makeatother
---

Ich nutze: Mac OS X (Yosemite V10.10.5), Texpad V1.7.21), MacTex

Antworten