summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/mindflow
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-05-26 03:05:34 +0000
committerNorbert Preining <norbert@preining.info>2021-05-26 03:05:34 +0000
commit8982c52e00ffb3fb5a913fc60913ebd9070f091a (patch)
tree6a395986e3502fefcf42364f8dd87519b45a2441 /macros/latex/contrib/mindflow
parent07dc96bc3bbd691fc52aca15a172eaf41a89d873 (diff)
CTAN sync 202105260305
Diffstat (limited to 'macros/latex/contrib/mindflow')
-rw-r--r--macros/latex/contrib/mindflow/mindflow.dtx298
-rw-r--r--macros/latex/contrib/mindflow/mindflow.pdfbin187098 -> 193099 bytes
2 files changed, 214 insertions, 84 deletions
diff --git a/macros/latex/contrib/mindflow/mindflow.dtx b/macros/latex/contrib/mindflow/mindflow.dtx
index 987bfc401a..3ba27be29e 100644
--- a/macros/latex/contrib/mindflow/mindflow.dtx
+++ b/macros/latex/contrib/mindflow/mindflow.dtx
@@ -18,7 +18,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{mindflow}
%<*package>
- [2021/05/23 mindflow environment]
+ [2021/05/25 mindflow environment]
%</package>
%
%<*driver>
@@ -29,11 +29,12 @@
\titleformat{\section}{\large\scshape\centering}{\thesection.}{.5em}{}
\titleformat{\subsection}{\large\itshape}{\thesubsection}{.5em}{}
\usepackage{titling}
-\setlength{\droptitle}{-.5in}
+\setlength{\droptitle}{-.7in}
\usepackage{enumitem}
\setlist{noitemsep}
\usepackage{mathpazo,newpxtext}
\useosf
+\usepackage{microtype}
\PassOptionsToPackage{mathlines}{lineno}
\usepackage[linenumber,rightmarker]{mindflow}
\usepackage{blindtext}
@@ -61,17 +62,21 @@
\lstset{moretexcs=%
{linenumbers,nolinenumbers,mindflowLeft,mindflowRight,mindflowTextFont,mindflowNumFont,mindflowMarkerFont,mindflowLineHeight,setlength,colorlet,color,
RequirePackage,SetupKeyvalOptions,DeclareBoolOption,ProcessKeyvalOptions,PassOptionsToPackage,
- if@mindflow@twocolumn,@mindflow@incolumntrue,if@mindflow@linenumber,@mindflow@leftlinenumbertrue,if@mindflow@off,if@mindflow@incolumn,if@mindflow@leftlinenumber,if@mindflow@rightlinenumber,if@mindflow@leftmarker,if@mindflow@rightmarker,
+ if@mindflow@twocolumn,@mindflow@incolumntrue,if@mindflow@linenumber,@mindflow@leftlinenumbertrue,if@mindflow@on,if@mindflow@off,@mindflow@offfalse,if@mindflow@incolumn,if@mindflow@leftlinenumber,if@mindflow@rightlinenumber,if@mindflow@leftmarker,if@mindflow@rightmarker,
ifLNturnsON,LNturnsONtrue,LNturnsONfalse,ifLineNumbers,
+ mindflowset,
mindflow,endmindflow,comment,endcomment,
+ mindflowON,endmindflowON,mindflowOFF,endmindflowOFF,
mfSepLine,makeLineNumber,LineNumber,
- ifdefined,linenomathpatch,cspreto,csappto,patchcmd,linenomathpatchAMS,linenomathAMS,linenomathWithnumbers,linenomath,endlinenomath,linenomathNonumbers,linenopenalty
+ ifdefined,linenomathpatch,cspreto,csappto,patchcmd,linenomathpatchAMS,linenomathAMS,linenomathWithnumbers,linenomath,endlinenomath,linenomathNonumbers,linenopenalty,
+ define@key,setkeys,
+ nowidow,
}
}
\lstnewenvironment{code*}%
{\setkeys{lst}{columns=fullflexible,keepspaces=true}}{}
\lstnewenvironment{code}%
-{\setkeys{lst}{columns=fullflexible,keepspaces=true,numbers=left,numberstyle=\scriptsize, stepnumber=1, numbersep=5pt,lastline=137}}{}
+{\setkeys{lst}{columns=fullflexible,keepspaces=true,numbers=left,numberstyle=\scriptsize, stepnumber=1, numbersep=5pt,lastline=202}}{}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@@ -95,14 +100,15 @@
% \section{Introduction}
%
% The \textsf{mindflow} package provides you a way to write your ideas
-% and annotations clearly. For exmaple, with the options
-% \verb|linenumber| and \verb|rightmarker|, you will get:
+% and annotations clearly. For example, with the options
+% \verb|linenumber| and \verb|rightmarker|, you will get something like:
% \begin{mindflow}
% What to write next:
% \begin{itemize}
-% \item usage;
+% \item usage: the initialization, options and configuration;
+% \item an example;
+% \item some word on the line numbering feature;
% \item some internal macros;
-% \item an example maybe;
% \item the complete code.
% \end{itemize}
% \end{mindflow}
@@ -125,7 +131,9 @@
% There are a few options available, which are listed in the next subsection.
%
% \subsection{Options}
-% By default, the environment has no line numbers or markers. You can use the following options:
+% By default, the environment has no line numbers or markers. You can use the
+% following options (they can be specified directly, like \verb|off|, or as a
+% boolean optional, like \verb|off=false|):
%
% \begin{tabular}{ll}
% \verb|linenumber| & Same as \verb|leftlinenumber|\\
@@ -134,7 +142,7 @@
% \verb|leftmarker| & Enable left marker, by default it is a ``\verb|*|''\\
% \verb|rightmarker| & Enable right marker, by default it is a ``\verb|*|''\\
% \verb|incolumn| or \verb|twocolumn| & The separation line would fit in the column \\&(\emph{automatically applied in two-column documents})\\
-% \verb|off| & Hide all the \verb|mindflow| environments
+% \verb|off|, \verb|on| & Turn the \verb|mindflow| environments \emph{off} or \emph{on}
% \end{tabular}
%
% \DescribeEnv{\{mindflow\}}
@@ -151,7 +159,79 @@
%</example>
% \fi
%
-% \subsection{About the line numbers}
+% \subsection{The configuration}
+%
+% \DescribeMacro{\mindflowset}
+% You can use \lstinline|\mindflowset{|\meta{configuration}\lstinline|}| to
+% configure the \texttt{mindflow} environment. The following keys are provided:
+%
+% \begin{center}
+% \begin{tabular}{ll}
+% \verb|left| & The left marker\\
+% \verb|right| & The right marker\\
+% \verb|textcolor| & Color of the text\\
+% \verb|numcolor| & Color of line numbers\\
+% \verb|markercolor| & Color of the markers\\
+% \verb|linecolor| & Color of the separation line \\
+% \end{tabular}
+%
+% \begin{tabular}{ll}
+% \verb|textfont| & Font of the text\\
+% \verb|numfont| & Font of line numbers\\
+% \verb|markerfont| & Font of the marker\\
+% \verb|lineheight| & Height of the separation line\\
+% \end{tabular}
+%\end{center}
+%
+% Additionally, all the options mentioned in the previous section can be set with \lstinline|\mindflowset|.
+%
+% \section{An example}
+% With the following settings:
+% \iffalse
+%<*example>
+% \fi
+\begin{code*}
+\mindflowset{
+ leftlinenumber, rightlinenumber,
+ leftmarker, rightmarker,
+ linecolor = green!50!black,
+ textcolor = blue!50!cyan,
+ numcolor = red!50!orange,
+ markercolor = orange,
+ textfont = \footnotesize\sffamily\itshape,
+ numfont = \small\footnotesize\ttfamily,
+ markerfont = \footnotesize\sffamily,
+ left = \hspace{1em}\(\succ\),
+ right = \(\prec\)\hspace{1em},
+ lineheight = 1pt
+}
+\end{code*}
+% \iffalse
+%</example>
+% \fi
+% \vspace{-.5\baselineskip}
+% One will have something like this:
+% \begingroup
+% \makeatletter
+% \@mindflow@leftmarkertrue
+% \@mindflow@rightlinenumbertrue
+% \makeatother
+% \colorlet{mindflowLine}{green!50!black}
+% \colorlet{mindflowText}{blue!50!cyan}
+% \colorlet{mindflowNum}{red!50!orange}
+% \colorlet{mindflowMarker}{orange}
+% \renewcommand{\mindflowTextFont}{\footnotesize\sffamily\itshape}
+% \renewcommand{\mindflowNumFont}{\small\footnotesize\ttfamily}
+% \renewcommand{\mindflowMarkerFont}{\footnotesize\sffamily}
+% \renewcommand{\mindflowLeft}{\hspace{1em}\(\succ\)}
+% \renewcommand{\mindflowRight}{\(\prec\)\hspace{1em}}
+% \setlength{\mindflowLineHeight}{1pt}
+% \begin{mindflow}
+% \blindtext
+% \end{mindflow}
+% \endgroup
+%
+% \section{About the line numbers}
% \linenumbers
%
% You can also add line numbers to the other part of your document in the usual
@@ -192,6 +272,8 @@
% \end{align*}
% \end{mindflow}
%
+% \clearpage
+% \centerline{\itshape ---~~Readers who are not interested in technical details can skip the rest~~---}
%
% \section{Some \TeX{}nical details}
%
@@ -206,9 +288,9 @@
%<*example>
% \fi
\begin{code*}
-\newcommand{\mindflowTextFont}{\normalfont\footnotesize}
-\newcommand{\mindflowNumFont}{\normalfont\scriptsize\ttfamily}
-\newcommand{\mindflowMarkerFont}{\normalfont\scriptsize\ttfamily}
+\newcommand{\mindflowTextFont}{\footnotesize}
+\newcommand{\mindflowNumFont}{\scriptsize\ttfamily}
+\newcommand{\mindflowMarkerFont}{\scriptsize\ttfamily}
\end{code*}
% \iffalse
%</example>
@@ -236,9 +318,9 @@
% the context, with opacity 30\% for the separation lines, text and markers, and
% 8\% for the line numbers.
%
-% \section{An example}
-% With option \verb|leftlinenumber, rightlinenumber, leftmarker, rightmarker| and the
-% following settings:
+% \section{The same example}
+% With option \verb|leftlinenumber, rightlinenumber, leftmarker, rightmarker|
+% and the following settings:
% \iffalse
%<*example>
% \fi
@@ -247,9 +329,9 @@
\colorlet{mindflowText}{blue!50!cyan}
\colorlet{mindflowNum}{red!50!orange}
\colorlet{mindflowMarker}{orange}
-\renewcommand{\mindflowTextFont}{\normalfont\footnotesize\sffamily\itshape}
-\renewcommand{\mindflowNumFont}{\normalfont\small\footnotesize\ttfamily}
-\renewcommand{\mindflowMarkerFont}{\normalfont\footnotesize\sffamily}
+\renewcommand{\mindflowTextFont}{\footnotesize\sffamily\itshape}
+\renewcommand{\mindflowNumFont}{\small\footnotesize\ttfamily}
+\renewcommand{\mindflowMarkerFont}{\footnotesize\sffamily}
\renewcommand{\mindflowLeft}{\hspace{1em}\(\succ\)}
\renewcommand{\mindflowRight}{\(\prec\)\hspace{1em}}
\setlength{\mindflowLineHeight}{1pt}
@@ -258,24 +340,7 @@
%</example>
% \fi
% \vspace{-.5\baselineskip}
-% One gets:
-% \makeatletter
-% \@mindflow@leftmarkertrue
-% \@mindflow@rightlinenumbertrue
-% \makeatother
-% \colorlet{mindflowLine}{green!50!black}
-% \colorlet{mindflowText}{blue!50!cyan}
-% \colorlet{mindflowNum}{red!50!orange}
-% \colorlet{mindflowMarker}{orange}
-% \renewcommand{\mindflowTextFont}{\normalfont\footnotesize\sffamily\itshape}
-% \renewcommand{\mindflowNumFont}{\normalfont\small\footnotesize\ttfamily}
-% \renewcommand{\mindflowMarkerFont}{\normalfont\footnotesize\sffamily}
-% \renewcommand{\mindflowLeft}{\hspace{1em}\(\succ\)}
-% \renewcommand{\mindflowRight}{\(\prec\)\hspace{1em}}
-% \setlength{\mindflowLineHeight}{1pt}
-% \begin{mindflow}
-% \blindtext
-% \end{mindflow}
+% One will get the same result as in the previous example.
%
% \StopEventually{}
%
@@ -288,6 +353,7 @@
family = @mindflow,
prefix = @mindflow@
}
+\DeclareBoolOption[true]{on} % Turn on mindflow
\DeclareBoolOption[false]{off} % Turn off mindflow
\DeclareBoolOption[false]{leftmarker} % Left marker
\DeclareBoolOption[false]{rightmarker} % Right marker
@@ -299,6 +365,9 @@
\ProcessKeyvalOptions*\relax
+\if@mindflow@on
+ \@mindflow@offfalse
+\fi
\if@mindflow@twocolumn
\@mindflow@incolumntrue
\fi
@@ -318,9 +387,9 @@
\colorlet{mindflowMarker}{mfSavedColor!30}
\colorlet{mindflowNum}{mfSavedColor!8}
-\newcommand{\mindflowTextFont}{\normalfont\footnotesize}
-\newcommand{\mindflowNumFont}{\normalfont\scriptsize\ttfamily}
-\newcommand{\mindflowMarkerFont}{\normalfont\scriptsize\ttfamily}
+\newcommand{\mindflowTextFont}{\footnotesize}
+\newcommand{\mindflowNumFont}{\scriptsize\ttfamily}
+\newcommand{\mindflowMarkerFont}{\scriptsize\ttfamily}
\newcommand{\mindflowLeft}{*}
\newcommand{\mindflowRight}{*}
\newlength{\mindflowLineHeight}
@@ -329,19 +398,22 @@
%%================================
%% The mindflow environment
%%================================
+\RequirePackage{nowidow}
+\RequirePackage{verbatim}
\newif\ifLNturnsON
\newcommand*{\mfSepLine}{%
\parskip=0pt
+ \nowidow[3]\par\nobreak%
\LNturnsONfalse%
\ifLineNumbers\LNturnsONtrue\fi\nolinenumbers%
- \par\noindent\nopagebreak%
+ \vspace*{-.5\baselineskip}%
\if@mindflow@incolumn%
- \makebox[\linewidth]{\rule{\linewidth}{\mindflowLineHeight}}%
+ \makebox[\linewidth]{\color{mindflowLine}\rule{\linewidth}{\mindflowLineHeight}}%
\else%
\hspace*{-\paperwidth}%
- \makebox[\linewidth]{\rule{4\paperwidth}{\mindflowLineHeight}}%
+ \makebox[\linewidth]{\color{mindflowLine}\rule{4\paperwidth}{\mindflowLineHeight}}%
\fi%
- \nopagebreak\par%
+ \nowidow[3]\par\nobreak%
\ifLNturnsON\linenumbers\fi%
}
@@ -349,49 +421,107 @@
\newcounter{mfLN}
\setcounter{mfLN}{1}
-\if@mindflow@off
- \RequirePackage{verbatim}
- \let\mindflow=\comment
- \let\endmindflow=\endcomment
-\else
- \newenvironment{mindflow}
- {%
- \setcounter{recordLN}{\value{linenumber}}%
- \setcounter{linenumber}{\value{mfLN}}%
- \LNturnsONfalse%
- \ifLineNumbers\LNturnsONtrue\fi\nolinenumbers%
- \color{mindflowLine}\mfSepLine%
- \mindflowTextFont\color{mindflowText}%
- \linenumbers%
- \renewcommand\makeLineNumber{%
- \hss%
- \if@mindflow@leftlinenumber%
- \mindflowNumFont\color{mindflowNum}\LineNumber\hspace{1em}%
+\let\mindflowOFF=\comment
+\let\endmindflowOFF=\endcomment
+
+\def\mindflowON{%
+ \medskip%
+ \setcounter{recordLN}{\value{linenumber}}%
+ \setcounter{linenumber}{\value{mfLN}}%
+ \LNturnsONfalse%
+ \ifLineNumbers\LNturnsONtrue\fi\nolinenumbers%
+ \mfSepLine%
+ \normalfont\mindflowTextFont\color{mindflowText}%
+ \linenumbers%
+ \renewcommand{\makeLineNumber}{%
+ \hss%
+ \if@mindflow@leftlinenumber%
+ \normalfont\mindflowNumFont\color{mindflowNum}\LineNumber\hspace{1em}%
+ \fi%
+ \color{mindflowMarker}%
+ \if@mindflow@leftmarker%
+ \normalfont\mindflowMarkerFont\mindflowLeft\hspace{1em}%
+ \fi%
+ \rlap{\hskip\textwidth%
+ \if@mindflow@rightmarker%
+ \hspace{1em}\mindflowRight%
\fi%
- \color{mindflowMarker}%
- \if@mindflow@leftmarker%
- \mindflowMarkerFont\mindflowLeft\hspace{1em}%
+ \if@mindflow@rightlinenumber%
+ \hspace{1em}%
+ \normalfont\mindflowNumFont\color{mindflowNum}\LineNumber%
\fi%
- \rlap{\hskip\textwidth%
- \if@mindflow@rightmarker%
- \hspace{1em}\mindflowRight%
- \fi%
- \if@mindflow@rightlinenumber%
- \hspace{1em}%
- \mindflowNumFont\color{mindflowNum}\LineNumber%
- \fi%
- }%
}%
- }
- {%
- \par%
- \vspace{-.5\baselineskip}\color{mindflowLine}\mfSepLine%
- \ifLNturnsON\linenumbers\fi%
- \setcounter{mfLN}{\value{linenumber}}%
- \setcounter{linenumber}{\value{recordLN}}%
- }
+ }%
+}
+\def\endmindflowON{%
+ \mfSepLine%
+ \ifLNturnsON\linenumbers\fi%
+ \setcounter{mfLN}{\value{linenumber}}%
+ \setcounter{linenumber}{\value{recordLN}}%
+ \medskip%
+}
+
+\if@mindflow@off
+ \let\mindflow=\mindflowOFF
+ \let\endmindflow=\endmindflowOFF
+\else
+ \let\mindflow=\mindflowON
+ \let\endmindflow=\endmindflowON
\fi
+%%================================
+%% \mindflowset
+%%================================
+\define@key{mindflow}{on}[true]{%
+ \csname @mindflow@on#1\endcsname%
+ \if@mindflow@off%
+ \let\mindflow=\mindflowOFF%
+ \let\endmindflow=\endmindflowOFF%
+ \else%
+ \let\mindflow=\mindflowON%
+ \let\endmindflow=\endmindflowON%
+ \fi%
+}
+\define@key{mindflow}{off}[true]{%
+ \csname @mindflow@off#1\endcsname%
+ \if@mindflow@off%
+ \let\mindflow=\mindflowOFF%
+ \let\endmindflow=\endmindflowOFF%
+ \else%
+ \let\mindflow=\mindflowON%
+ \let\endmindflow=\endmindflowON%
+ \fi%
+}
+\define@key{mindflow}{leftmarker}[true]{\csname @mindflow@leftmarker#1\endcsname}
+\define@key{mindflow}{rightmarker}[true]{\csname @mindflow@rightmarker#1\endcsname}
+\define@key{mindflow}{linenumber}[true]{\csname @mindflow@linenumber#1\endcsname}
+\define@key{mindflow}{leftlinenumber}[true]{\csname @mindflow@leftlinenumber#1\endcsname}
+\define@key{mindflow}{rightlinenumber}[true]{\csname @mindflow@rightlinenumber#1\endcsname}
+\define@key{mindflow}{twocolumn}[true]{\csname @mindflow@twocolumn#1\endcsname}
+\define@key{mindflow}{incolumn}[true]{\csname @mindflow@incolumn#1\endcsname}
+\define@key{mindflow}{linecolor}{\colorlet{mindflowLine}{#1}}
+\define@key{mindflow}{textcolor}{\colorlet{mindflowText}{#1}}
+\define@key{mindflow}{numcolor}{\colorlet{mindflowNum}{#1}}
+\define@key{mindflow}{markercolor}{\colorlet{mindflowMarker}{#1}}
+\define@key{mindflow}{textfont}{\renewcommand{\mindflowTextFont}{#1}}
+\define@key{mindflow}{numfont}{\renewcommand{\mindflowNumFont}{#1}}
+\define@key{mindflow}{markerfont}{\renewcommand{\mindflowMarkerFont}{#1}}
+\define@key{mindflow}{left}{\renewcommand{\mindflowLeft}{#1}}
+\define@key{mindflow}{right}{\renewcommand{\mindflowRight}{#1}}
+\define@key{mindflow}{lineheight}{\setlength{\mindflowLineHeight}{#1}}
+\newcommand{\mindflowset}[1]{%
+ \setkeys{mindflow}{#1}%
+ \if@mindflow@twocolumn%
+ \@mindflow@incolumntrue%
+ \fi%
+ \if@mindflow@linenumber%
+ \@mindflow@leftlinenumbertrue%
+ \fi%
+}
+
+%%================================
+%% lineno patch
+%%================================
\ifdefined\linenomathpatch\else
\RequirePackage{amsmath}
\RequirePackage{etoolbox}
diff --git a/macros/latex/contrib/mindflow/mindflow.pdf b/macros/latex/contrib/mindflow/mindflow.pdf
index be52cded1b..bc995ec59f 100644
--- a/macros/latex/contrib/mindflow/mindflow.pdf
+++ b/macros/latex/contrib/mindflow/mindflow.pdf
Binary files differ