Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 30a535c

Browse files
committed
Added support for adding environment/macro parameters more cleanly:
\op adds an optional parameter, and \p adds a required parameter. These are only defined in the context of the parameter list parameter of the envdesc and macrodesc environments.
1 parent eda232f commit 30a535c

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

Doc/texinputs/ltxmarkup.sty

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,29 @@
66
\ProvidesPackage{ltxmarkup}
77
\RequirePackage{python} % fulllineitems environment
88

9+
% These two macros are used in constructing the last parameter to the
10+
% envdesc and macrodesc environments.
11+
12+
\newcommand{\py@ltx@optparam}[1]{{[}\var{#1}{]}}
13+
\newcommand{\py@ltx@param}[1]{\{\var{#1}\}}
14+
915
\newenvironment{envdesc}[2]{
1016
\begin{fulllineitems}
11-
\item[\code{\e begin\{{\bfseries #1}\}#2}]
17+
\item[\code{\e begin\{{\bfseries #1}\}{%
18+
\let\op=\py@ltx@optparam%
19+
\let\p=\py@ltx@param%
20+
#2}}]
1221
%\item[\code{\e end\{{\bfseries #1}\}}]
1322
\index{#1 environment@\idxcode{#1} environment}
1423
\index{environments!#1@\idxcode{#1}}
1524
}{\end{fulllineitems}}
1625

1726
\newenvironment{macrodesc}[2]{
1827
\begin{fulllineitems}
19-
\item[\code{\e\bfseries#1}#2]
28+
\item[\code{\e\bfseries#1}{%
29+
\let\op=\py@ltx@optparam%
30+
\let\p=\py@ltx@param%
31+
#2}]
2032
\index{#1@\idxcode{\e #1}}
2133
}{\end{fulllineitems}}
2234

0 commit comments

Comments
 (0)