From 33309d66543ec543d061fe0a976f5a1989346f16 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 25 May 2021 20:49:00 +0000 Subject: mindflow (25may21) git-svn-id: svn://tug.org/texlive/trunk@59346 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/mindflow/mindflow.sty | 157 +++++++++++++++------- 1 file changed, 111 insertions(+), 46 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/mindflow/mindflow.sty b/Master/texmf-dist/tex/latex/mindflow/mindflow.sty index 84c4d1cdb4a..6dfa2ca1e94 100644 --- a/Master/texmf-dist/tex/latex/mindflow/mindflow.sty +++ b/Master/texmf-dist/tex/latex/mindflow/mindflow.sty @@ -17,12 +17,13 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{mindflow} - [2021/05/23 mindflow environment] + [2021/05/25 mindflow environment] \RequirePackage{kvoptions} \SetupKeyvalOptions{% 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 @@ -34,6 +35,9 @@ \ProcessKeyvalOptions*\relax +\if@mindflow@on + \@mindflow@offfalse +\fi \if@mindflow@twocolumn \@mindflow@incolumntrue \fi @@ -53,9 +57,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} @@ -64,19 +68,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% } @@ -84,49 +91,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} -- cgit v1.2.3