diff options
author | Karl Berry <karl@freefriends.org> | 2013-08-03 22:41:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-08-03 22:41:55 +0000 |
commit | cd61954ea4b5198086d57352c8445f06a86d6741 (patch) | |
tree | d5b47f9fc581d38395dc63ff21a55bc98b2fb38c /Master/texmf-dist/doc/latex/noindentafter | |
parent | 701f292b739328b78643d55880a0a26d4ddbaabb (diff) |
noindentafter (3aug13)
git-svn-id: svn://tug.org/texlive/trunk@31341 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/noindentafter')
-rw-r--r-- | Master/texmf-dist/doc/latex/noindentafter/README | 33 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/noindentafter/dry.sty | 56 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/noindentafter/noindentafter.pdf | bin | 0 -> 214935 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/noindentafter/noindentafter.tex | 195 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/noindentafter/packagedoc.cls | 313 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/noindentafter/with.sty | 309 |
6 files changed, 906 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/noindentafter/README b/Master/texmf-dist/doc/latex/noindentafter/README new file mode 100644 index 00000000000..c88754ff185 --- /dev/null +++ b/Master/texmf-dist/doc/latex/noindentafter/README @@ -0,0 +1,33 @@ +LaTeX Package : noindentafter 0.0.1 + +Last Modified : 2013-08-02 + +Author : Michiel Helvensteijn (www.mhelvens.net) + +===== Prerequisites ===== + +To use this package, you need only 'etoolbox', though to generate +the documentation some other packages are needed. + +===== Installation ===== + +noindentafter.sty is provided directly in the package archive. Put +it in a place where your LaTeX distribution can find it. + +(noindentafter.sty is not generated, but manually maintained; you + may use docstrip to remove the documentation, but you don't + have to; it will just work the way it is) + +===== Documentation ===== + +noindentafter.pdf is provided directly in the package archive. To +generate the documentation yourself, run LaTeX on noindentafter.tex. + +(noindentafter.tex does not contain the package code itself; it inputs + noindentafter.sty directly to document the implementation) + +===== License ===== + +This material is subject to the LaTeX Project Public License. See +http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html +for the details of that license. diff --git a/Master/texmf-dist/doc/latex/noindentafter/dry.sty b/Master/texmf-dist/doc/latex/noindentafter/dry.sty new file mode 100644 index 00000000000..d2b723393c1 --- /dev/null +++ b/Master/texmf-dist/doc/latex/noindentafter/dry.sty @@ -0,0 +1,56 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \iffalse %%%% +% % +% Copyright (c) 2013 - Michiel Helvensteijn (www.mhelvens.net) % +% % +% http://latex-noindentafter.googlecode.com % +% % +% This work may be distributed and/or modified under the conditions % +% of the LaTeX Project Public License, either version 1.3 of this % +% license or (at your option) any later version. The latest version % +% of this license is in http://www.latex-project.org/lppl.txt % +% and version 1.3 or later is part of all distributions of LaTeX % +% version 2005/12/01 or later. % +% % +% This work has the LPPL maintenance status `author-maintained'. % +% % +% The Current Maintainer of this work is Michiel Helvensteijn. % +% % +% This work consists of the file dry.sty. % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi %%%% + +% I will 'officially' release this package at some point in the future. For +% now I'm just using it to document a couple of packages. Still, it's +% released under LPPL, so use it as you will. +% +% -- Michiel Helvensteijn + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{dry} + [2012/12/19 convenience macros for reusing LaTeX code] + +\RequirePackage{filecontents} +\RequirePackage{xparse} +\RequirePackage{etoolbox} +\RequirePackage{with} + +\newcommand\minput[1]{% + \input{#1}\unskip% +} + +\NewDocumentCommand{\NewDRYer}{m +m}{% + \with{un} [#1] [#2] {% + \newenvironment{#1}{% + \begingroup% + \@tempswafalse\filec@ntents{##1.tmp}% + }{% + \endfilecontents% + \endgroup% + }% + \AfterEndEnvironment{#1}{% + \with{xn} [##1.tmp] [\minput{##1.tmp}] {% + ##2% + }% + }% + }% +} diff --git a/Master/texmf-dist/doc/latex/noindentafter/noindentafter.pdf b/Master/texmf-dist/doc/latex/noindentafter/noindentafter.pdf Binary files differnew file mode 100644 index 00000000000..0e915825c57 --- /dev/null +++ b/Master/texmf-dist/doc/latex/noindentafter/noindentafter.pdf diff --git a/Master/texmf-dist/doc/latex/noindentafter/noindentafter.tex b/Master/texmf-dist/doc/latex/noindentafter/noindentafter.tex new file mode 100644 index 00000000000..aba9eacff2b --- /dev/null +++ b/Master/texmf-dist/doc/latex/noindentafter/noindentafter.tex @@ -0,0 +1,195 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% Copyright (c) 2013 - Michiel Helvensteijn - www.mhelvens.net % +% % +% http://latex-noindentafter.googlecode.com % +% % +% This work may be distributed and/or modified under the % +% conditions of the LaTeX Project Public License, either % +% version 1.3 of this license or (at your option) any later % +% version. The latest version of this license is in % +% http://www.latex-project.org/lppl.txt % +% and version 1.3 or later is part of all distributions of % +% LaTeX version 2005/12/01 or later. % +% % +% This work has the LPPL maintenance status `maintained'. % +% % +% The Current Maintainer of this work is Michiel Helvensteijn. % +% % +% This work consists of the files noindentafter.tex and noindentafter.sty. % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\documentclass[a4paper]{packagedoc} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Setup % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\NoIndentAfterEnv{latex-example-show} +\NoIndentAfterCmd{\describemacro} + +\moretexcs{% + NoIndentAfterThis,NoIndentAfterEnv,NoIndentAfterCmd +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Global Changes % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\changes{0.0.1}{2013/08/02} + {initial version} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\maketitle + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Introduction} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Some people prefer certain LaTeX environments ---such as |itemize| or +|theorem|--- never to be followed by an indented paragraph. It is of course +possible to manually add the |\noindent| command to each occurrence, but +it's easy to forget to do this. Also, all those |\noindent| commands leave +your \TeX{} code just a little bit more chaotic and more burdensome to read. + +There are a number of solutions floating around, but many of them are not +particularly robust, or only work in specific cases. + +The |noindentafter| package provides a few simple commands which can be used +to patch existing macros and environments. They work as expected in all cases +I've encountered. + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Usage} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\noindent\DescribeMacro{\NoIndentAfterThis} +% +This is the most primitive macro offered by the package. It forces a +paragraph break and suppresses indentation for whatever follows: + +\begin{latex-example-show} + Lorem ipsum dolor sit amet, consectetur adipiscing + elit. \NoIndentAfterThis Pellentesque hendrerit volutpat + feugiat. Ut purus leo, pulvinar sit amet vehicula non, + pulvinar eu lacus. Curabitur id mollis ligula. +\end{latex-example-show} + + + +\pagebreak % Hack to make the footnote appear on page 1. + + + +\describemacro{\NoIndentAfterEnv}{\marg{environment}} + +This is probably the command most people will want to use. +The \meta{environment} argument should contain an environment +name. After using this command, any paragraph following such +an environment will remain unindented. + +\begin{latex-example-show} + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + + \begin{itemize} + \item First Item + \item Second Item + \end{itemize} + + Pellentesque hendrerit volutpat feugiat. Ut purus + leo, pulvinar sit amet vehicula non, pulvinar eu + lacus. Curabitur id mollis ligula. + + \NoIndentAfterEnv{itemize} + + Vestibulum id erat venenatis, facilisis enim non, + consectetur felis. Quisque iaculis eu arcu non pretium. + + \begin{itemize} + \item Third Item + \item Fourth Item + \end{itemize} + + Curabitur est elit, posuere pulvinar laoreet sed, varius + id mi. Nam lobortis elit nec mauris condimentum gravida. +\end{latex-example-show} + +You'll probably want to use these commands in the document +preamble but, as you can see, you don't really have to. + +\needspace{10\baselineskip} +Note that using the |\NoIndentAfterEnv| command on your own +environment is not the same as adding |\NoIndentAfterThis| +to the end of it: + +\begin{latex-example-show} + \newenvironment{test}{\itshape}{\NoIndentAfterThis} + + \begin{test} + Lorem ipsum dolor sit amet, consectetur + adipiscing elit. + \end{test} + + Pellentesque hendrerit volutpat feugiat. Ut purus + leo, pulvinar sit amet vehicula non, pulvinar eu + lacus. Curabitur id mollis ligula. +\end{latex-example-show} + +|\NoIndentAfterEnv| works because it bypasses the group +that surrounds every \LaTeX{} environment (and localizes +declarations). + + + +\describemacro{\NoIndentAfterCmd}{\marg{command}} + +Finally, you may also patch command sequences using the +|\NoIndentAfterCmd| command. There may not be many situations +where this is useful, but for me, there is at least one: + +\begin{latex-example-show} + Lorem ipsum dolor sit amet, consectetur adipiscing elit: + + \[ 1 + 1 = 2 \] + + Pellentesque hendrerit volutpat feugiat. Ut purus leo: + + \NoIndentAfterCmd \] + + \[ 2 + 2 = 4 \] + + Vestibulum id erat venenatis, facilisis enim non, + consectetur felis. +\end{latex-example-show} + +Note that braces around the \meta{command} argument are +optional, as always when an argument in \TeX{} consists +of only a single token. + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Acknowledgements} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +I had been looking for a solution like this for quite a while. I came up +with a number of hacks that workedin some situations but not in others. +Eventually I asked a question on \url{http://tex.stackexchange.com}: +\begin{itemize} + \item \url{http://tex.stackexchange.com/questions/112404} +\end{itemize} + +I received two excellent answers -- one from cgnieder and one from lockstep. +This package is based on the technique proposed by cgnieder, as it is +simpler and more generally applicable. Still, the answer by lockstep +is definitely worth a read. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\end{document} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/doc/latex/noindentafter/packagedoc.cls b/Master/texmf-dist/doc/latex/noindentafter/packagedoc.cls new file mode 100644 index 00000000000..bfbd129136f --- /dev/null +++ b/Master/texmf-dist/doc/latex/noindentafter/packagedoc.cls @@ -0,0 +1,313 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% Copyright (C) 2012-2013 by Michiel Helvensteijn - www.mhelvens.net % +% % +% This work may be distributed and/or modified under the % +% conditions of the LaTeX Project Public License, either % +% version 1.3 of this license or (at your option) any later % +% version. The latest version of this license is in % +% http://www.latex-project.org/lppl.txt % +% and version 1.3 or later is part of all distributions of % +% LaTeX version 2005/12/01 or later. % +% % +% This work has the LPPL maintenance status `author-maintained'. % +% % +% The Current Maintainer of this work is Michiel Helvensteijn. % +% % +% This work consists of the file packagedoc.cls. % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\let\packagename\jobname + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Document Class % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LoadClassWithOptions{ltxdoc} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Importing The Relevant Package % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\RequirePackage{\packagename} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Importing Other Packages % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\RequirePackage[hyphens]{url} + +\RequirePackage{etoolbox} +\RequirePackage[xcolor]{mdframed} +\RequirePackage{marginnote} +\RequirePackage{listings} +\RequirePackage{textcomp} +\RequirePackage[colorlinks=true]{hyperref} +\RequirePackage{dry} +\RequirePackage{needspace} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Documentation Options % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\EnableCrossrefs +\CodelineIndex +\RecordChanges + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% File Info % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\GetFileInfo{\packagename.sty} + +\title{The \textsf{\packagename} package\thanks{% + This document corresponds to \textsf{\packagename}~\fileversion, + dated \filedate.% +}} + +\author{ + Michiel Helvensteijn\\ + \href{mailto:mhelvens+latex@gmail.com}{mhelvens+latex@gmail.com} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Development Info % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newmdenv[ + leftline = false, + rightline = false +]{bannerframe} + +\apptocmd{\maketitle}{ + \begin{bannerframe} + \small + \begin{center} + Development of this package is organized at + \href{http://latex-\packagename.googlecode.com} + {latex-\packagename.googlecode.com}.\\ + I am happy to receive feedback there! + \end{center} + \end{bannerframe} +}{}{} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Example Environment Setup % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%% Extra keywords for LaTeX +% +\newcommand{\moretexcs}[1]{ + \lstdefinelanguage{latex}{ + language=[LaTeX]tex, + alsoletter={\[,\],\$}, + moretexcs={ExplSyntaxOn,ExplSyntaxOff,lstinputlisting,detokenize,[,],#1}, + keywords={\$} + } +} + +%%% Code formatting +% +\lstdefinestyle{examplecode}{% + language=latex,% + basicstyle=\ttfamily\small,% + texcsstyle=*\bfseries,% + keywordstyle=*\bfseries,% + upquote=true% +} + +%%% Setting up example code block +% +\definecolor{examplecodelinecolor}{rgb}{0,0,0} +\definecolor{examplecodebackgroundcolor}{rgb}{.9,.9,.9} +\newmdenv[ + linecolor = examplecodelinecolor, + backgroundcolor = examplecodebackgroundcolor, + skipabove = 0pt, + skipbelow = 0pt, + innertopmargin = -1pt, + innerrightmargin = 1pt, + innerbottommargin = -1pt, + innerleftmargin = 1pt +]{examplecodeframe} + +%%% Defining example output block +% +\definecolor{exampleoutputbackgroundcolor}{rgb}{1,1,1} +\newmdenv[ + linecolor = examplecodelinecolor, + backgroundcolor = exampleoutputbackgroundcolor, + skipabove = 0pt, + skipbelow = 0pt, + innertopmargin = 6pt, + innerrightmargin = 6pt, + innerbottommargin = 6pt, + innerleftmargin = 6pt, + nobreak = true +]{exampleoutputframe} + +%%% Macros for counting lines in file, adapted from +%%% http://andreas.scherbaum.la/blog/archives/ +%%% 670-Read-number-lines-in-a-file-in-LaTeX.html +% +\RequirePackage{ifthen} +\newboolean{packagedoc@restfile} +\newcommand*{\packagedoc@fileline}{} +\newread\packagedoc@file +\newcommand*{\packagedoc@readnextline}[1]{% + \ifthenelse{\boolean{packagedoc@restfile}}{% + \read#1 to \packagedoc@fileline% + \ifeof#1\setboolean{packagedoc@restfile}{false}% + \else\fi% + }{}% +} +\newcommand*{\countlinesinfile}[2]{% + \setboolean{packagedoc@restfile}{true}% + \setcounter{packagedoc@linecount}{0}% + \openin\packagedoc@file=#1% + \whiledo{\boolean{packagedoc@restfile}}{% + \packagedoc@readnextline{\packagedoc@file}% + \ifthenelse{\boolean{packagedoc@restfile}}{% + \stepcounter{packagedoc@linecount}% + }{}% + }% + \closein\packagedoc@file% + \edef#2{\thepackagedoc@linecount}% +} + +\newcounter{packagedoc@linecount} +\newlength{\packagedoc@spacetoreserve} + +%%% DRYer without output +% +\NewDRYer{latex-example}{% + \vskip\abovedisplayskip% + {% + \ttfamily\small% + \countlinesinfile{#1}{\countedlines}% + \setlength{\packagedoc@spacetoreserve}{\countedlines\baselineskip}% + \addtolength{\packagedoc@spacetoreserve}{-1pt}% + \needspace{\packagedoc@spacetoreserve}% + }% + \begin{examplecodeframe}% + \renewcommand{\ttdefault}{pcr}% + \lstinputlisting[style=examplecode]{#1}% + \end{examplecodeframe}% + #2% + \vskip\belowdisplayskip% +} + +%%% DRYer WITH output but WITHOUT side-effects +% +\NewDRYer{latex-example-show}{% + \vskip\abovedisplayskip% + {% + \ttfamily\small% + \countlinesinfile{#1}{\countedlines}% + \setlength{\packagedoc@spacetoreserve}{\countedlines\baselineskip}% + \addtolength{\packagedoc@spacetoreserve}{\baselineskip}% + \needspace{\packagedoc@spacetoreserve}% + }% + \begin{examplecodeframe}% + \renewcommand{\ttdefault}{pcr}% + \lstinputlisting[style=examplecode]{#1}% + \end{examplecodeframe}\vspace{-1pt}% + \begin{exampleoutputframe}% + #2% + \end{exampleoutputframe}% + \vskip\belowdisplayskip% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Implementation Code Box Setup % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%% Saving old implementation code block font +% +\AtBeginDocument{\let\old@macro@font\macro@font} + +%%% Setup for 'interesting' implementation code blocks +% +\definecolor{interestingcodebackgroundcolor}{rgb}{.9,.9,.9} +\definecolor{interestingcodelinecolor}{rgb}{0,0,0} +\mdfdefinestyle{interestingcode}{ + linecolor = interestingcodelinecolor, + backgroundcolor = interestingcodebackgroundcolor +} +\newcommand*{\interesting}{% + \def\codestyle{interestingcode}% + \def\codeskipabove{2pt}% + \let\macro@font\old@macro@font% +} + +%%% Setup for 'UNinteresting' implementation code blocks +% +\definecolor{uninterestingcodebackgroundcolor}{rgb}{.97,.97,.97} +\definecolor{uninterestingcodelinecolor}{rgb}{.5,.5,.5} +\definecolor{uninterestingcodecolor}{rgb}{.4,.4,.4} +\mdfdefinestyle{uninterestingcode}{ + linecolor = uninterestingcodelinecolor, + backgroundcolor = uninterestingcodebackgroundcolor, +} +\newcommand*{\uninteresting}{% + \def\codestyle{uninterestingcode}% + \def\codeskipabove{-2pt}% + \def\macro@font{\color{uninterestingcodecolor}\old@macro@font}% +} + +%%% Actually surround 'macrocode' with the frame +% +\surroundwithmdframed[ + style = \codestyle, + skipabove = \abovedisplayskip, + skipbelow = \belowdisplayskip, + splittopskip = 4pt, + splitbottomskip = 1pt, + innertopmargin = -2pt, + innerrightmargin = 1pt, + innerbottommargin = 5pt, + innerleftmargin = 4pt +]{macrocode} + +%%% Start out with 'interesting' code status and +%%% always go back to it after one code block +% +\interesting +\AfterEndEnvironment{macrocode}{\interesting} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Argument Specifiers and such % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcommand*{\movarg}[1]{[ \texttt{#1} ]} +\newcommand*{\momarg}[1]{[ \meta{#1} ]} + +\newcommand{\describemacro}[2]{% + \needspace{3\baselineskip}% + \noindent\\\DescribeMacro{#1} #2\\% +} + +\newcommand{\describemetamacro}[2]{% + \needspace{3\baselineskip}% + \noindent\\\marginnote{\meta{#1}} #2\\% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Automatic Implementation Docs % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\AtEndDocument{ + \section{Implementation} + + \StopEventually {\PrintChanges} + + We now show and explain the entire implementation from \texttt{\packagename.sty}. + + \DocInput{\packagename.sty} + + \Finale + + \PrintIndex +} diff --git a/Master/texmf-dist/doc/latex/noindentafter/with.sty b/Master/texmf-dist/doc/latex/noindentafter/with.sty new file mode 100644 index 00000000000..dcaa976b281 --- /dev/null +++ b/Master/texmf-dist/doc/latex/noindentafter/with.sty @@ -0,0 +1,309 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \iffalse %%%% +% % +% Copyright (c) 2013 - Michiel Helvensteijn (www.mhelvens.net) % +% % +% http://latex-with.googlecode.com % +% % +% This work may be distributed and/or modified under the conditions % +% of the LaTeX Project Public License, either version 1.3 of this % +% license or (at your option) any later version. The latest version % +% of this license is in http://www.latex-project.org/lppl.txt % +% and version 1.3 or later is part of all distributions of LaTeX % +% version 2005/12/01 or later. % +% % +% This work has the LPPL maintenance status `author-maintained'. % +% % +% The Current Maintainer of this work is Michiel Helvensteijn. % +% % +% This work consists of the file with.sty and with.tex. % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi %%%% + +% \CheckSum{0} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Package Info} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\ProvidesExplPackage{with}{2012/12/23}{0.0.1} + {an inline construct for passing token lists as parameters} +% \end{macrocode} + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Required Packages} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +% \begin{macrocode} +\RequirePackage{xparse} +\RequirePackage{l3regex} +% \end{macrocode} + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Package Code} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +% \begin{macrocode} +\cs_generate_variant:Nn \cs_generate_variant:Nn {cn} +% \end{macrocode} + + + +% \begin{macrocode} +\cs_new:Nn \gen_use:nn { + \cs_generate_variant:cn + { #1 : \prg_replicate:nn{\tl_count:n{#2}}{n} } + { #2 } + \use:c{ #1 : #2 } +} +% \end{macrocode} + + + +% \begin{macrocode} +\cs_new_protected:Nn \with:n {#1} +\cs_new_protected:Nn \with:nn { + \cs_set:Npn \__with:n ##1 {#2} + \__with:n {#1} } +\cs_new_protected:Nn \with:nnn { + \cs_set:Npn \__with:nn ##1##2 {#3} + \__with:nn {#1}{#2} } +\cs_new_protected:Nn \with:nnnn { + \cs_set:Npn \__with:nnn ##1##2##3 {#4} + \__with:nnn {#1}{#2}{#3} } +\cs_new_protected:Nn \with:nnnnn { + \cs_set:Npn \__with:nnnn ##1##2##3##4 {#5} + \__with:nnnn {#1}{#2}{#3}{#4} } +\cs_new_protected:Nn \with:nnnnnn { + \cs_set:Npn \__with:nnnnn ##1##2##3##4##5 {#6} + \__with:nnnnn {#1}{#2}{#3}{#4}{#5} } +\cs_new_protected:Nn \with:nnnnnnn { + \cs_set:Npn \__with:nnnnnn ##1##2##3##4##5##6 {#7} + \__with:nnnnnn {#1}{#2}{#3}{#4}{#5}{#6} } +\cs_new_protected:Nn \with:nnnnnnnn { + \cs_set:Npn \__with:nnnnnnn ##1##2##3##4##5##6##7 {#8} + \__with:nnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}{#7} } +\cs_new_protected:Nn \with:nnnnnnnnn { + \cs_set:Npn \__with:nnnnnnnn ##1##2##3##4##5##6##7##8 {#9} + \__with:nnnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8} } +% \end{macrocode} + + + +% \begin{macrocode} +\msg_new:nnnn{with}{invalid-parameter-specs}{ + The~argument~specification~'#1'~is~not~valid. +}{ + The~argument~specification~should~consist~of~between~ + one~and~seven~of~the~letters~'n',~'o',~'f',~'x',~'u'~or~'U'. +} +% \end{macrocode} + + + +% \begin{macrocode} +\msg_new:nnnn{with}{invalid-parameter-number}{ + You~specified~#1~arguments~but~provided~#2. +}{ + Your~argument~specification~is~'#3',~which~means~you~should~ + provide~#1~optional~arguments.~However,~you~provided~only~#2. +} +% \end{macrocode} + + + +% \begin{macrocode} +\tl_new:N \l__with_argspec_tl +\tl_new:c {l__with_p_1_tl} \tl_new:c {l__with_p_2_tl} +\tl_new:c {l__with_p_3_tl} \tl_new:c {l__with_p_4_tl} +\tl_new:c {l__with_p_5_tl} \tl_new:c {l__with_p_6_tl} +\tl_new:c {l__with_p_7_tl} +\tl_new:N \l__with_code_tl +% \end{macrocode} + + + +% \begin{macrocode} +\int_new:N \l__with_arg_int +\cs_new:Nn \__with_param_name: { + l__with_p_ + \int_use:N\l__with_arg_int + _tl +} +% \end{macrocode} + + + +% \begin{macrocode} +\tl_new:N \l__with_unique_counter_tl +\tl_new:N \l__with_param_tl +% \end{macrocode} + + + +% \begin{macrocode} +\cs_generate_variant:Nn \with:nn {xn} +\cs_generate_variant:Nn \with:nnnnnnnnn {oooooooon} +% \end{macrocode} + + + +% \begin{macrocode} +\NewDocumentCommand \with {m +o +o +o +o +o +o +o +m} { +% \end{macrocode} + + + +% \begin{macrocode} + \regex_match:nnF {^[noxfuU]{1,7}$} {#1} + { \msg_critical:nnn{with}{invalid-parameter-specs}{#1} } +% \end{macrocode} + + + +% \begin{macrocode} + \tl_set:Nn \l__with_argspec_tl {#1} + \int_zero:N \l__with_arg_int + \IfValueT{#2} { + \tl_set:cn {l__with_p_1_tl} {#2} \int_incr:N \l__with_arg_int + \IfValueT{#3} { + \tl_set:cn {l__with_p_2_tl} {#3} \int_incr:N \l__with_arg_int + \IfValueT{#4} { + \tl_set:cn {l__with_p_3_tl} {#4} \int_incr:N \l__with_arg_int + \IfValueT{#5} { + \tl_set:cn {l__with_p_4_tl} {#5} \int_incr:N \l__with_arg_int + \IfValueT{#6} { + \tl_set:cn {l__with_p_5_tl} {#6} \int_incr:N \l__with_arg_int + \IfValueT{#7} { + \tl_set:cn {l__with_p_6_tl} {#7} \int_incr:N \l__with_arg_int + \IfValueT{#8} { + \tl_set:cn {l__with_p_7_tl} {#8} \int_incr:N \l__with_arg_int + }}}}}}} + \tl_set:Nn \l__with_code_tl {#9} +% \end{macrocode} + + + +% \begin{macrocode} + \int_compare:nNnF {\tl_count:n{#1}} = {\l__with_arg_int} { + \msg_error:nnxxx{with}{invalid-parameter-number} + { \tl_count:n{#1} } + { \int_use:N \l__with_arg_int } + { #1 } + } +% \end{macrocode} + + + +% \begin{macrocode} + \tl_replace_all:Nnn \l__with_argspec_tl {u} {x} + \tl_replace_all:Nnn \l__with_argspec_tl {U} {c} +% \end{macrocode} + + + +% \begin{macrocode} + \int_zero:N \l__with_arg_int + \tl_map_inline:nn {#1} { + \int_incr:N \l__with_arg_int +% \end{macrocode} + + + +% \begin{macrocode} + \tl_if_in:nnT {uU} {##1} { + \tl_set:Nx \l__with_unique_counter_tl + { g__with_unique_ \use:c{\__with_param_name:} _count_int } + + \int_if_exist:cF {\l__with_unique_counter_tl} + { \int_new:c {\l__with_unique_counter_tl} } + + \int_incr:c {\l__with_unique_counter_tl} + + \tl_put_left:cx {\__with_param_name:} + { g_with_unique_ } + + \tl_put_right:cx {\__with_param_name:} + { _ \int_use:c{\l__with_unique_counter_tl} } + } +% \end{macrocode} + + + +% \uninteresting\begin{macrocode} + } +% \end{macrocode} + + + +% \begin{macrocode} + \with:oooooooon {\l__with_argspec_tl} + {\cs:w l__with_p_1_tl \cs_end:} + {\cs:w l__with_p_2_tl \cs_end:} + {\cs:w l__with_p_3_tl \cs_end:} + {\cs:w l__with_p_4_tl \cs_end:} + {\cs:w l__with_p_5_tl \cs_end:} + {\cs:w l__with_p_6_tl \cs_end:} + {\cs:w l__with_p_7_tl \cs_end:} { + \with:oooooooon {##1o}{##2}{##3}{##4} + {##5}{##6}{##7}{##8} { + \int_case:nnn {\l__with_arg_int} { + {1} { \gen_use:nn{with}{####1} + {####2} {\l__with_code_tl} } + {2} { \gen_use:nn{with}{####1} + {####2}{####3} {\l__with_code_tl} } + {3} { \gen_use:nn{with}{####1} + {####2}{####3}{####4} {\l__with_code_tl} } + {4} { \gen_use:nn{with}{####1} + {####2}{####3}{####4} + {####5} {\l__with_code_tl} } + {5} { \gen_use:nn{with}{####1} + {####2}{####3}{####4} + {####5}{####6} {\l__with_code_tl} } + {6} { \gen_use:nn{with}{####1} + {####2}{####3}{####4} + {####5}{####6}{####7} {\l__with_code_tl} } + {7} { \gen_use:nn{with}{####1} + {####2}{####3}{####4} + {####5}{####6}{####7} + {####8} {\l__with_code_tl} } + }{} + } + } +% \end{macrocode} + + + +% \uninteresting\begin{macrocode} +} +% \end{macrocode} + + |