diff options
Diffstat (limited to 'macros/latex/contrib/mnotes/mnotes.dtx')
-rw-r--r-- | macros/latex/contrib/mnotes/mnotes.dtx | 81 |
1 files changed, 63 insertions, 18 deletions
diff --git a/macros/latex/contrib/mnotes/mnotes.dtx b/macros/latex/contrib/mnotes/mnotes.dtx index babd0566a6..35a406bf01 100644 --- a/macros/latex/contrib/mnotes/mnotes.dtx +++ b/macros/latex/contrib/mnotes/mnotes.dtx @@ -28,13 +28,12 @@ % %% @LaTeX-package-file{ %% author = "Saturnino Luz", -%% version = "0.6", -%% date = "18 April 2013", +%% version = "0.9", +%% date = "25 May 2022", %% filename = "mnotes.dtx", %% address = "S Luz -%% Trinity College %% Dublin, Ireland", -%% URL = "http://www.scss.tcd.ie/~luzs/", +%% URL = "https://gitlab.com/e1700/mnotes/", %% email = "luzs@acm.org", %% codetable = "ISO/ASCII", %% keywords = "margin, notes, comments", @@ -55,7 +54,7 @@ This is a generated file. -Copyright (C) 2013 by S Luz <luzs@acm.org> +Copyright (C) 2013-2021 by S Luz <luzs@acm.org> This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license @@ -93,7 +92,7 @@ and version 1.3 or later is part of all distributions of LaTeX version %</driver> %<package>\ProvidesPackage{mnotes}[% %<*driver|package> - 2013/20/04 v0.7 margin notes for collaborative document editing] + 2022/25/05 v0.9 margin notes for collaborative document editing] %</driver|package> %<*driver> \documentclass{ltxdoc} @@ -153,7 +152,7 @@ and version 1.3 or later is part of all distributions of LaTeX version % % \section{Package options} % -% The basic usage is to include a \verb+\usepackage{mnote}+ to the +% The basic usage is to include a \verb+\usepackage{mnotes}+ to the % preamble of your \LaTeX\ document. % % The \textsf{mnotes} package also provides some basic @@ -227,6 +226,23 @@ and version 1.3 or later is part of all distributions of LaTeX version % are not regular \LaTeX\ users. % \end{verbatim} % +% \DescribeMacro{\Mnewauthor} Define author-specific margin notes for +% comments. \\The +% \verb+\Mnewauthor[<initials>]{<name>}{<todonote specs>}+ macro +% defines a command for personalised comments by author \verb+name+ by +% setting up the command \verb+\mn<initials>[highlight]{comment}+ +% which can then be used in the text. Usage: +% \begin{verbatim} +% \newauthor[BD]{Bob}{yellow} +% \end{verbatim} +% This defines \verb+\mnBD+, which can be used to comment and highlight +% as follows: +% \begin{verbatim} +% \mnBD[this is highlighted]{this is a margin note.} or, +% alternatively, without highlighting +% \mnBDhis is a margin note with no highlights.} +% \end{verbatim} +% % \DescribeMacro{\HideMNOTES} Comments can be ``switched off'' at any % point in the text by adding a \verb+\HideMNOTES{}+ command anywhere % in the text. @@ -248,6 +264,7 @@ and version 1.3 or later is part of all distributions of LaTeX version % is passed % as an option. In this case, note placement reverts to \LaTeX{}'s % kernel's \verb+\marginpar+ macro. +% \item[soul] for highlighting. % \item[tikz] for graphics (boxes and connectors). N.B.: % \texttt{tikz} is note required if \texttt{basic} is passed as an % option. @@ -288,6 +305,7 @@ and version 1.3 or later is part of all distributions of LaTeX version % Get package options % \begin{macrocode} \RequirePackage{kvoptions} +\RequirePackage{soul} \DeclareVoidOption{basic}{\@mnotes@basictrue} \DeclareVoidOption{sidenotes}{\@mnotes@sidenotestrue} \DeclareVoidOption{hide}{\@mnotes@hidetrue \AtEndOfPackage{\HideMNOTES{}}} @@ -295,8 +313,8 @@ and version 1.3 or later is part of all distributions of LaTeX version \SetupKeyvalOptions{family=mnotes, prefix=mnotes@} \DeclareStringOption{scale}[1.05] \define@key{mnotes}{scale}{\if@mnotes@hide\else% -\pdfpagewidth#1\paperwidth\@mnotes@scaletrue\fi} -\DeclareVoidOption{centre}{\if@mnotes@scale\hoffset\pdfpagewidth +\setlength{\paperwidth}{#1\paperwidth}\@mnotes@scaletrue\fi} +\DeclareVoidOption{centre}{\if@mnotes@scale\hoffset\paperwidth \advance\hoffset-\paperwidth \hoffset.5\hoffset\fi} \DeclareStringOption{mnwidth}[\MNOTEWIDTH] @@ -307,6 +325,8 @@ and version 1.3 or later is part of all distributions of LaTeX version \define@key{mnotes}{fontsize}{% \count1=#1 \multiply \count1 by 116 \divide \count1 by 100% \def\MNFONT{\fontsize{#1}{\count1}\selectfont}} +%% try to keep notes on the same margin +% \makeatletter \@mparswitchfalse \makeatother %\ExecuteOptions{} \ProcessKeyvalOptions{mnotes} %\ProcessOptions @@ -352,8 +372,8 @@ and version 1.3 or later is part of all distributions of LaTeX version [{\MNFONT\raggedleft\color{#1}\em #2}]% {\MNFONT\raggedright\color{#1}\em #2}}% \else% not basic -\newcommand{\MNOTEon}[2][\MNCOLOUR]{ -\setlength{\marginparsep}{6pt}\setlength{\marginparwidth}{\MNOTEWIDTH} +\newcommand{\MNOTEon}[2][\MNCOLOUR]{% +\setlength{\marginparsep}{6pt}\setlength{\marginparwidth}{\MNOTEWIDTH}% \begin{tikzpicture}[remember picture, baseline=-0.75ex]% \node [coordinate] (textPOS) {};% \end{tikzpicture}% @@ -362,7 +382,7 @@ and version 1.3 or later is part of all distributions of LaTeX version {\MNFONT\raggedright\em% \begin{tikzpicture}[remember picture]% \draw node [draw=#1,text width=\MNOTEWIDTH-1pt] (notePOS) {#2};% -\end{tikzpicture} +\end{tikzpicture}% }% \else \marginpar% @@ -377,17 +397,17 @@ and version 1.3 or later is part of all distributions of LaTeX version \fi% \if@twocolumn% \if@firstcolumn% - \if@mnotes@reverseconnect + \if@mnotes@reverseconnect% \mnoteswestlink{#1}% - \else + \else% \mnoteseastlink{#1}% - \fi + \fi% \else% - \if@mnotes@reverseconnect + \if@mnotes@reverseconnect% \mnoteseastlink{#1}% - \else + \else% \mnoteswestlink{#1}% - \fi + \fi% \fi% \else% \if@twoside% @@ -419,6 +439,31 @@ and version 1.3 or later is part of all distributions of LaTeX version \fi % \end{macrocode} % \end{macro} +%\begin{macro} +% Define author-specific margin notes for comments. +% Syntax: \verb'\Mnewauthor[<initials>]{<name>}{color}' +% Example: +% \verb'\Mnewauthor[SL]{Nino}{yellow}' +% Sets up the command \verb'\mn<initials>{}' which can then be used in the +% text. +% E.g.: +% \verb'\mnSL[this is highlighted]{this is a margin note.}' +% \verb'\mnSL{this is a margin note with no highlights.}' +% \begin{macrocode} +\newcommand{\Mnewauthor}[3][]{% + % If #1 is not given, use #2 by default as the cmd name + \def\@tempa{#1}% + \ifx\@tempa\@empty% + \def\@authid{#2}% + \else% + \def\@authid{#1}% + \fi% + % Define the \mnX command with the colour and so on + \expandafter\newcommand\csname mn\@authid\endcsname[2][]{% + \if@mnotes@hide ##1\else\sethlcolor{#3}\hl{##1}\MNOTE[#3]{#2: ##2}{}\fi}% +} +% \end{macrocode} +% \end{macro} % \begin{macro}{\MNOTE} % User interface to \verb+\MNOTEon+ % \begin{macrocode} |