summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pseudo
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-06-30 21:01:23 +0000
committerKarl Berry <karl@freefriends.org>2019-06-30 21:01:23 +0000
commit900b22de16e6b4ced56d7f4ab57238d4a813d0b2 (patch)
tree2c44dd63c6e8dacff11509e8f81b8e9b7639443b /Master/texmf-dist/doc/latex/pseudo
parent7984fe8874929e533690ce453b4f74865352e267 (diff)
pseudo (30jun19)
git-svn-id: svn://tug.org/texlive/trunk@51511 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/pseudo')
-rw-r--r--Master/texmf-dist/doc/latex/pseudo/VERSION2
-rw-r--r--Master/texmf-dist/doc/latex/pseudo/doc/fig/hilitefig.tex30
-rw-r--r--Master/texmf-dist/doc/latex/pseudo/doc/fig/pausefig.tex37
-rw-r--r--Master/texmf-dist/doc/latex/pseudo/doc/pseudo.pdfbin512746 -> 525757 bytes
-rw-r--r--Master/texmf-dist/doc/latex/pseudo/doc/pseudo.tex165
5 files changed, 168 insertions, 66 deletions
diff --git a/Master/texmf-dist/doc/latex/pseudo/VERSION b/Master/texmf-dist/doc/latex/pseudo/VERSION
index 7dea76edb3d..9459d4ba2a0 100644
--- a/Master/texmf-dist/doc/latex/pseudo/VERSION
+++ b/Master/texmf-dist/doc/latex/pseudo/VERSION
@@ -1 +1 @@
-1.0.1
+1.1
diff --git a/Master/texmf-dist/doc/latex/pseudo/doc/fig/hilitefig.tex b/Master/texmf-dist/doc/latex/pseudo/doc/fig/hilitefig.tex
index 7ea3be4a9cc..8cffae23a43 100644
--- a/Master/texmf-dist/doc/latex/pseudo/doc/fig/hilitefig.tex
+++ b/Master/texmf-dist/doc/latex/pseudo/doc/fig/hilitefig.tex
@@ -1,39 +1,11 @@
\documentclass[beamer,preview,multi]{standalone}
-% \documentclass{beamer}
-% \usepackage{mlh}
\usepackage{pseudo}
-% \pseudoset{kw, hpad, kwfont=\bfseries}
-% \pseudoset{kw, hpad, kwfont=\bfseries}
-\pseudoset{hpad}
+\pseudoset{hpad, compact}
\standaloneenv{myenv}
-% XXX My \== gets ruined by the standalone preview option for some reason.
-
\begin{document}
-% \begin{standaloneframe}
-% \begin{myenv}
-% \begin{pseudo}[hpad] <1-3>
-% if $x < y$ \\+ <2> [bol=\onslide<2->]
-% $\id{foo} = 2$ \\- [hl<3>, bol=\onslide<3->]
-% howdy
-% \end{pseudo}
-% \end{myenv}
-% \end{standaloneframe}
-
-% \begin{standaloneframe}
-% \begin{myenv}
-% \begin{pseudo} <1,4>
-% while $a \neq b$ \\+ <2>
-% if $a > b$ \\+
-% $a = a - b$ \\- <3>
-% else $b = b - a$ \\- <5>
-% return $a$
-% \end{pseudo}
-% \end{myenv}
-% \end{standaloneframe}
-
\begin{standaloneframe}
\begin{myenv}
\begin{pseudo}
diff --git a/Master/texmf-dist/doc/latex/pseudo/doc/fig/pausefig.tex b/Master/texmf-dist/doc/latex/pseudo/doc/fig/pausefig.tex
index 9cb10a48e77..bbc7ee91fd2 100644
--- a/Master/texmf-dist/doc/latex/pseudo/doc/fig/pausefig.tex
+++ b/Master/texmf-dist/doc/latex/pseudo/doc/fig/pausefig.tex
@@ -1,48 +1,14 @@
\documentclass[beamer,preview,multi]{standalone}
-% \documentclass{beamer}
-
-% \usepackage[notmath]{sansmathfonts}
-% \usepackage{mlh}
\usepackage{pseudo}
-% \pseudoset{kw, hpad, kwfont=\bfseries, prfont=\sffamily}
-
-% \usepackage{expl3,xparse}
-%
-% \makeatletter
-% \ExplSyntaxOn
-%
-% \int_new:N \g_@@_row_num_int
-%
-% \cs_new:Nn \@@_onslide: {
-% \int_gincr:N \g_@@_row_num_int
-% \onslide<\g_@@_row_num_int->
-% }
-%
-% \NewDocumentCommand \pseudostartslide {} {
-% \int_zero:N \g_@@_row_num_int
-% }
-%
-% \cs_set_eq:NN \pseudoonslide \@@_onslide:
-% % \cs_set_eq:NN \oldctrcmd \__pseudo_old_counter_cmds:
-%
-% \ExplSyntaxOff
-% \makeatother
+\pseudoset{compact}
\setbeamercovered{transparent}
\standaloneenv{myenv}
\begin{document}
-
-% \begin{frame}
\begin{standaloneframe}
\begin{myenv}
-% XXX Begins on line 2, as it hasn't been incremented yet. And several
-% solutions (like \onslide<+-> or \pause) just break down.
-% XXX Working on an "uncover" option. Should probably have a similar thing
-% that dims out the previous ones -- or maybe even a "dim" key...
-%
-% XXX Use the suffix package to get the starred versions
\begin{pseudo}[pause]
Eeny \\
Meeny \\
@@ -51,6 +17,5 @@
\end{pseudo}
\end{myenv}
\end{standaloneframe}
-% \end{frame}
\end{document}
diff --git a/Master/texmf-dist/doc/latex/pseudo/doc/pseudo.pdf b/Master/texmf-dist/doc/latex/pseudo/doc/pseudo.pdf
index 8bc210729cc..c9fe6491a34 100644
--- a/Master/texmf-dist/doc/latex/pseudo/doc/pseudo.pdf
+++ b/Master/texmf-dist/doc/latex/pseudo/doc/pseudo.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/pseudo/doc/pseudo.tex b/Master/texmf-dist/doc/latex/pseudo/doc/pseudo.tex
index a283879b677..25c5c099e27 100644
--- a/Master/texmf-dist/doc/latex/pseudo/doc/pseudo.tex
+++ b/Master/texmf-dist/doc/latex/pseudo/doc/pseudo.tex
@@ -438,6 +438,15 @@ repeat the following while $a\neq b$ \\+
\end{texexp}
\noindent
+Spacing is handled similarly to in \LaTeX\ lists, with \cs{topsep} and
+\cs{parskip} added before and after, as well as \cs{partopsep} whenever the
+environment starts a new paragraph. The left margin (how much the pseudocode
+is indented wrt.\ the surrounding text) is set by the \refk{left-margin} key
+(initially \code{0pt}).\footnote{If \refe{pseudo} occurs in a box such as
+\code{fbox}, or a \pkg[https://ctan.org/pkg/pgf]{tikz} node, this spacing is
+dropped.}
+
+\medskip\noindent
There are also some styling commands for special elements of the pseudocode:
\begin{texexp}
@@ -1044,6 +1053,45 @@ alphabetical order), you'll find definitions of a couple of counters here
\fontcmd{cn}
\end{docCommand}
+\begin{docKey}{compact}{\,=\,\meta{boolean}}{default \code{true}, initially
+ \code{false}}
+
+ \parindent1.5em
+ \noindent
+ The \refe{pseudo} environment emulates the built-in \LaTeX\ lists when it
+ comes to spacing above and below, in normal text. If the environment is
+ part of an ongoing paragraph, paragraphs will be inserted above and below,
+ along with whitespace specified by \refk{topsep} and \refk{parskip}. If
+ the environment begins a paragraph of its own, additional whitespace is
+ added, as specified by \refk{partopsep}. It is also possible to specify
+ space to insert to the left of the environment, using \refk{left-margin}.
+
+ However, these spacing commands don't work well inside \cs{mbox},
+ \cs{fbox}, etc. To avoid getting into trouble, \pkg{pseudo} determines
+ that the environment should be \emph{compact}, and drop this surrounding
+ space, if we're in inner horizontal mode at the beginning of the
+ environment.
+
+\begin{texexp}
+% In preamble:
+% \usepackage{tikz}
+\begin{tikzpicture}
+ \draw (0,0) node [draw] {%
+ \begin{pseudo}
+ if we're in a node \\+
+ there's no added space
+ \end{pseudo}};
+\end{tikzpicture}
+\end{texexp}
+
+ This may not be enough, however. For example, if you're using
+ \pkg[https://ctan.org/pkg/standalone]{standalone} to produce individual
+ pseudocode images, this compactness will \emph{not} be triggered
+ automatically. In such cases, you can override the behavior using the
+ \refk{compact} trigger, manually specifying whether you want the
+ pseudocode to be compact or not.
+\end{docKey}
+
\begin{docCommand}{ct}{\marg{text}}
Indicates that \meta{text} is a comment, \ct{typeset like this}. You can
customize the comment appearance using \refk{ctfont}, \refk{ct-left} and
@@ -1551,6 +1599,40 @@ goto \tn{\ref{li:label}}
get the results you want by specifying your own \refk{preamble} in full.
\end{docKey}
+\begin{docKey}{left-margin}{\,=\,\meta{length}}{\initialkeyvalue{\code{0pt}}}
+ Sets the left margin of the \code{pseudo} environment, i.e., how far it is
+ indented wrt.\ the surrounding text:
+\begin{texexp}
+Lorem ipsum dolor sit amet:
+
+\begin{pseudo}[left-margin=1.25em]
+consetetur sadipscing elitr \\
+sed diam nonumy eirmod tempor
+\end{pseudo}
+
+Invidunt ut labore et dolore magna.
+\end{texexp}
+
+To have the environment indented as (the beginning of) any normal paragraph,
+you could use \code*{left-margin = \cs{parindent}}. Note that
+\refk{left-margin}, as well as the spacing above and below the \refe{pseudo}
+environment, is turned off inside \cs{mbox} and the like:
+\begin{texexp}
+\pseudoset{left-margin=1cm} % Won't affect box contents
+\fbox{\begin{pseudo*}
+I'm a livin' in a box \\
+I'm a livin' in a cardboard box
+\end{pseudo*}}
+\end{texexp}
+Note that as opposed to \refk{topsep}, \refk{parskip} and \refk{partopsep}, we
+are \emph{not} working with one of the built-in list spacing commands;
+\cs{leftmargin} has no effect on this key (which is why the hyphenated naming
+style of other keys such as \refk{label-align} or \refk{indent-text} is also
+adopted for \refk{left-margin}).
+%
+See also \refk{compact}.
+\end{docKey}
+
\begin{docKey}{line-height}{\,=\,\meta{factor}}{\initialkeyvalue{\code{1}}}
The \meta{factor} with which to multiply the ordinary line height. For
simple, sparse pseudocode, the oridnary line height works well, but if
@@ -1569,6 +1651,16 @@ goto \tn{\ref{li:label}}
See also \refc{tn}.
\end{docCommand}
+\begin{docKey}{parskip}{\,=\,\meta{length}}{\initialkeyvalue{\cs{parskip}}}
+ Sets a \pkg{pseudo}-local copy of \cs{parskip} for use in vertical spacing
+ above and below the \refe{pseudo} environment. See also \refk{compact}.
+\end{docKey}
+
+\begin{docKey}{partopsep}{\,=\,\meta{length}}{\initialkeyvalue{\cs{partopsep}}}
+ Sets a \pkg{pseudo}-local copy of \cs{partopsep} for use in vertical
+ spacing above and below the \refe{pseudo} environment. See also \refk{compact}.
+\end{docKey}
+
\begin{docKey}{pause}{}{\novaluekey}
Equivalent to \code*{\refk{eol-append} = \cs{pause}} (see \cref{p:pause}).
\end{docKey}
@@ -1856,6 +1948,11 @@ See also \refk{indent-level}.
\shortcutted{tn}{textnormal}
\end{docCommand}
+\begin{docKey}{topsep}{\,=\,\meta{length}}{\initialkeyvalue{\cs{topsep}}}
+ Sets a \pkg{pseudo}-local copy of \cs{topsep} for use in vertical spacing
+ above and below the \refe{pseudo} environment. See also \refk{compact}.
+\end{docKey}
+
\begin{docKey}{unknown}{}{}
Unknown keys are checked for \pkg[https://ctan.org/pkg/beamer]{beamer}
overlay specifications. That is, if an unknown key has the form
@@ -2894,6 +2991,9 @@ typesetting the pseudocode.
hsep .tl_set:N = \l_@@_hsep_tl,
hsep .initial:n = .75em,
+ left-margin .tl_set:N = \l_@@_left_margin_tl,
+ left-margin .initial:n = 0pt,
+
label .tl_set:N = \l_@@_label_tl,
label .initial:n = \arabic*,
@@ -3042,6 +3142,32 @@ The prefix is inserted by the row separator command.
end-tabular .tl_set:N = \l_@@_end_tabular_tl,
end-tabular .initial:n = \end{tabular},
\end{source}
+\paragraph{List-like spacing.} Space above and below is handled similarly to
+in the built-in \LaTeX\ lists, with the option of locally overriding
+\cs{topsep}, \cs{parskip} and \cs{partopsep}, with \refk{compact} used to
+control the presence of this spacing (overriding the ordinary automatic choice
+based on the current mode).
+\begin{source}
+ topsep .tl_set:N = \l_@@_topsep_tl,
+ topsep .initial:n = { \topsep },
+
+ parskip .tl_set:N = \l_@@_parskip_tl,
+ parskip .initial:n = { \parskip },
+
+ partopsep .tl_set:N = \l_@@_partopsep_tl,
+ partopsep .initial:n = { \partopsep },
+
+ compact .meta:n = {
+ compact-val = #1,
+ compact-def = true,
+ },
+ compact .default:n = true,
+
+ % For internal use:
+ compact-val .bool_set:N = \l_@@_compact_bool,
+ compact-def .bool_set:N = \l_@@_compact_def_bool,
+\end{source}
+
\paragraph{Details.} Finally, some tweakable parameters.
\begin{source}
eqs-scale .fp_set:N = \l_@@_eqs_scale_fp,
@@ -3053,6 +3179,7 @@ The prefix is inserted by the row separator command.
eqs-pad .tl_set:N = \l_@@_eqs_pad_tl,
eqs-pad .initial:n = 0.28mu,
+
}
\end{source}
%
@@ -3290,6 +3417,7 @@ various macros already described.
\NewDocumentEnvironment { pseudo } { !+o !s d<> +O{ } } {
\group_begin:
+
\@@_gsave_as:NN \\ \c_@@_saved_cr_cs
\@@_gsave_as:NN \= \c_@@_saved_eq_cs
@@ -3304,6 +3432,32 @@ various macros already described.
}
\@@_set_indent_length:
+ % If not manually set as compact/noncompact, set automatically:
+ \bool_if:NF \l_@@_compact_def_bool {
+ \bool_set:Nn \l_@@_compact_bool {
+ \mode_if_horizontal_p: && \mode_if_inner_p:
+ }
+ }
+
+ \bool_if:nF { \l_@@_compact_bool } {
+
+ \skip_set:Nn \l_tmpa_skip {
+ \l_@@_topsep_tl + \l_@@_parskip_tl
+ }
+ \mode_if_vertical:TF {
+ \skip_add:Nn \l_tmpa_skip { \l_@@_partopsep_tl }
+ } {
+ \unskip \par
+ }
+
+ \addvspace { \l_tmpa_skip }
+
+ \noindent
+ \skip_horizontal:n{ \dim_eval:n { \l_@@_left_margin_tl } }
+
+ }
+
+
\dim_set:Nn \tabcolsep { \l_@@_hsep_tl / 2 }
\tl_set:Nn \arraystretch
{ \fp_to_decimal:n { \l_@@_line_height_fp } }
@@ -3356,6 +3510,17 @@ the line:
\tl_use:N \l_@@_end_tabular_tl
+
+ \bool_if:nF { \l_@@_compact_bool } {
+
+ \mode_if_vertical:F {
+ \unskip \par
+ }
+
+ \addvspace{ \l_tmpa_skip }
+
+ }
+
\group_end:
}