public inbox for gentoo-pms@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-pms] Some formatting changes for algorithms and listings
@ 2015-11-03 19:58 Ulrich Müller
  2015-11-03 19:59 ` [gentoo-pms] [PATCH 1/3] pms.cls: More uniform style " Ulrich Müller
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ulrich Müller @ 2015-11-03 19:58 UTC (permalink / raw
  To: gentoo-pms

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

Hi all,

Following are three patches to be applied preferably before EAPI 6
approval. Main changes are to move the ebuild functions into listing
environments, so that they will appear in the List of Listings. Also
uses a more uniform style for algorithms and listings, and numbers
algorithms per chapter (as it is already done for tables etc.).

There are no changes to the text of the spec itself.

Ulrich

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gentoo-pms] [PATCH 1/3] pms.cls: More uniform style for algorithms and listings.
  2015-11-03 19:58 [gentoo-pms] Some formatting changes for algorithms and listings Ulrich Müller
@ 2015-11-03 19:59 ` Ulrich Müller
  2015-11-03 20:01 ` [gentoo-pms] [PATCH 2/3] Inline all listing files. Fix verbatim environments Ulrich Müller
  2015-11-03 20:03 ` [gentoo-pms] [PATCH 3/3] Move listings of ebuild functions into listing environments Ulrich Müller
  2 siblings, 0 replies; 4+ messages in thread
From: Ulrich Müller @ 2015-11-03 19:59 UTC (permalink / raw
  To: gentoo-pms

[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]

Number algorithms per chapter, as it is done for all other floats.
Use the same "ruled" caption style for listings as for algorithms.
Change header for the list of listings to "List of Listings".
---
 pms.cls | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pms.cls b/pms.cls
index 0b900c0..222690c 100644
--- a/pms.cls
+++ b/pms.cls
@@ -18,6 +18,7 @@
 \PassOptionsToPackage{utf8}{inputenc}
 \PassOptionsToPackage{quiet}{marginnote}
 \PassOptionsToPackage{nottoc,notlot,notlof}{tocbibind}
+\PassOptionsToPackage{chapter}{algorithm}
 % algorithmic and algorithm to be loaded last to avoid failures
 \RequirePackage{%
     fontenc,	% Load extended font sets
@@ -69,11 +70,12 @@
 
 % tex4ht workaround: these need to happen after loading the float package
 \g@addto@macro\@documentclasshook{
-    \floatstyle{plaintop}
+    \floatstyle{ruled}
     \newfloat{listing}{tbp}{lol}[chapter]
     \floatname{listing}{Listing}
 }
-\newcommand{\listoflistings}{\listof{listing}{Listings}}
+\newcommand{\listoflistings}{\listof{listing}{List of Listings}}
+
 % Define own label and reference commands, that display the label in
 % the page margin.
 \newcommand{\featureref}[1]{\textsc{#1} on page~\pageref{feat:#1}}
-- 
2.6.2

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-pms] [PATCH 2/3] Inline all listing files. Fix verbatim environments.
  2015-11-03 19:58 [gentoo-pms] Some formatting changes for algorithms and listings Ulrich Müller
  2015-11-03 19:59 ` [gentoo-pms] [PATCH 1/3] pms.cls: More uniform style " Ulrich Müller
@ 2015-11-03 20:01 ` Ulrich Müller
  2015-11-03 20:03 ` [gentoo-pms] [PATCH 3/3] Move listings of ebuild functions into listing environments Ulrich Müller
  2 siblings, 0 replies; 4+ messages in thread
From: Ulrich Müller @ 2015-11-03 20:01 UTC (permalink / raw
  To: gentoo-pms

[-- Attachment #1: Type: text/plain, Size: 5489 bytes --]

---
 Makefile             |  4 +---
 appendices.tex       | 12 ++++++++++--
 ebuild-env-state.tex | 32 ++++++++++++++++++++++++++++++--
 eclasses.tex         |  6 +++---
 env-saving.listing   | 27 ---------------------------
 if-else-use.listing  |  7 -------
 pkg-mgr-commands.tex |  7 ++++---
 7 files changed, 48 insertions(+), 47 deletions(-)
 delete mode 100644 env-saving.listing
 delete mode 100644 if-else-use.listing

diff --git a/Makefile b/Makefile
index a20f5ec..83a6f51 100644
--- a/Makefile
+++ b/Makefile
@@ -8,9 +8,7 @@ clean :
 maintainer-clean: clean
 	rm -f vc.tex
 
-LATEXFILES := $(filter-out vc.tex,$(wildcard *.tex)) pms.cls
-LISTINGFILES := $(wildcard *.listing)
-SOURCEFILES = $(LATEXFILES) $(LISTINGFILES)
+SOURCEFILES := $(filter-out vc.tex,$(wildcard *.tex)) pms.cls
 
 pms.pdf: $(SOURCEFILES) pms.bbl vc.tex eapi-cheatsheet.pdf
 	@# latex chokes on aux files produced by tex4ht, so remove them
diff --git a/appendices.tex b/appendices.tex
index eb51dc9..0e64bc5 100644
--- a/appendices.tex
+++ b/appendices.tex
@@ -39,8 +39,16 @@ was met, and the block after the colon would be taken if the condition was not m
 This feature was deprecated and removed from the tree long before the introduction of \t{EAPI}.
 
 \begin{listing}
-  \caption{If-else use blocks}\label{lst:if-else-use-listing}
-  \verbatiminput{if-else-use.listing}
+\caption{If-else use blocks} \label{lst:if-else-use-listing}
+\begin{verbatim}
+DEPEND="
+    flag? (
+        taken/if-true
+    ) : (
+        taken/if-false
+    )
+    "
+\end{verbatim}
 \end{listing}
 
 \section{cvs Versions}
diff --git a/ebuild-env-state.tex b/ebuild-env-state.tex
index 4bc80c7..3ddd1ab 100644
--- a/ebuild-env-state.tex
+++ b/ebuild-env-state.tex
@@ -20,8 +20,36 @@ in the build sequence.
 This is demonstrated by code listing~\ref{lst:env-saving}.
 
 \begin{listing}
-  \caption{Environment state between functions}\label{lst:env-saving}
-  \verbatiminput{env-saving.listing}
+\caption{Environment state between functions} \label{lst:env-saving}
+\begin{verbatim}
+GLOBAL_VARIABLE="a"
+
+src_compile()
+{
+    GLOBAL_VARIABLE="b"
+    DEFAULT_VARIABLE="c"
+    export EXPORTED_VARIABLE="d"
+    local LOCAL_VARIABLE="e"
+}
+
+src_install(){
+    [[ ${GLOBAL_VARIABLE} == "a" ]] \
+        || [[ ${GLOBAL_VARIABLE} == "b" ]] \
+        || die "broken env saving for globals"
+
+    [[ ${DEFAULT_VARIABLE} == "c" ]] \
+        || die "broken env saving for default"
+
+    [[ ${EXPORTED_VARIABLE} == "d" ]] \
+        || die "broken env saving for exported"
+
+    [[ $(printenv EXPORTED_VARIABLE ) == "d" ]] \
+        || die "broken env saving for exported"
+
+    [[ -z ${LOCAL_VARIABLE} ]] \
+        || die "broken env saving for locals"
+}
+\end{verbatim}
 \end{listing}
 
 % vim: set filetype=tex fileencoding=utf8 et tw=100 spell spelllang=en :
diff --git a/eclasses.tex b/eclasses.tex
index 24ff77f..0f172f7 100644
--- a/eclasses.tex
+++ b/eclasses.tex
@@ -49,8 +49,8 @@ call the eclass-defined version from it. The use of it is best illustrated by an
 given in listing~\ref{lst:export-functions} and is a snippet from a hypothetical \t{foo.eclass}.
 
 \begin{listing}
-  \caption{EXPORT\_FUNCTIONS example: foo.eclass}\label{lst:export-functions}
-  \begin{verbatim}
+\caption{EXPORT\_FUNCTIONS example: foo.eclass} \label{lst:export-functions}
+\begin{verbatim}
 foo_src_compile()
 {
     econf --enable-gerbil \
@@ -60,7 +60,7 @@ foo_src_compile()
 }
 
 EXPORT_FUNCTIONS src_compile
-  \end{verbatim}
+\end{verbatim}
 \end{listing}
 
 This example defines an eclass \t{src\_compile} function and uses \t{EXPORT\_FUNCTIONS} to alias
diff --git a/env-saving.listing b/env-saving.listing
deleted file mode 100644
index 1650aa7..0000000
--- a/env-saving.listing
+++ /dev/null
@@ -1,27 +0,0 @@
-GLOBAL_VARIABLE="a"
-
-src_compile()
-{
-    GLOBAL_VARIABLE="b"
-    DEFAULT_VARIABLE="c"
-    export EXPORTED_VARIABLE="d"
-    local LOCAL_VARIABLE="e"
-}
-
-src_install(){
-    [[ ${GLOBAL_VARIABLE} == "a" ]] \
-        || [[ ${GLOBAL_VARIABLE} == "b" ]] \
-        || die "broken env saving for globals"
-
-    [[ ${DEFAULT_VARIABLE} == "c" ]] \
-        || die "broken env saving for default"
-
-    [[ ${EXPORTED_VARIABLE} == "d" ]] \
-        || die "broken env saving for exported"
-
-    [[ $(printenv EXPORTED_VARIABLE ) == "d" ]] \
-        || die "broken env saving for exported"
-
-    [[ -z ${LOCAL_VARIABLE} ]] \
-        || die "broken env saving for locals"
-}
diff --git a/if-else-use.listing b/if-else-use.listing
deleted file mode 100644
index 83a2ae8..0000000
--- a/if-else-use.listing
+++ /dev/null
@@ -1,7 +0,0 @@
-DEPEND="
-    flag? (
-        taken/if-true
-    ) : (
-        taken/if-false
-    )
-    "
diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex
index 83fbd68..d7347fe 100644
--- a/pkg-mgr-commands.tex
+++ b/pkg-mgr-commands.tex
@@ -224,9 +224,10 @@ current phase function has returned.
     \t{D} instead of \t{ED} in the command given in Listing~\ref{lst:einstall}.
     Variable \t{libdir} is an auxiliary local variable whose value is determined by
     Algorithm~\ref{alg:ebuild-libdir}.
+
 \begin{listing}[H]
-  \caption{einstall command}\label{lst:einstall}
-  \begin{verbatim}
+\caption{einstall command} \label{lst:einstall}
+\begin{verbatim}
 emake \
    prefix="${ED}"/usr \
    datadir="${ED}"/usr/share \
@@ -238,7 +239,7 @@ emake \
    -j1 \
    "$@" \
    install
-  \end{verbatim}
+\end{verbatim}
 \end{listing}
 
 \end{description}
-- 
2.6.2

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-pms] [PATCH 3/3] Move listings of ebuild functions into listing environments.
  2015-11-03 19:58 [gentoo-pms] Some formatting changes for algorithms and listings Ulrich Müller
  2015-11-03 19:59 ` [gentoo-pms] [PATCH 1/3] pms.cls: More uniform style " Ulrich Müller
  2015-11-03 20:01 ` [gentoo-pms] [PATCH 2/3] Inline all listing files. Fix verbatim environments Ulrich Müller
@ 2015-11-03 20:03 ` Ulrich Müller
  2 siblings, 0 replies; 4+ messages in thread
From: Ulrich Müller @ 2015-11-03 20:03 UTC (permalink / raw
  To: gentoo-pms

[-- Attachment #1: Type: text/plain, Size: 3368 bytes --]

---
 ebuild-functions.tex | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/ebuild-functions.tex b/ebuild-functions.tex
index 480ccda..084e866 100644
--- a/ebuild-functions.tex
+++ b/ebuild-functions.tex
@@ -115,6 +115,8 @@ apply patches and set up the package's build system for further use.
 The initial working directory must be \t{WORKDIR}, and the default implementation used when
 the ebuild lacks the \t{src\_unpack} function shall behave as:
 
+\begin{listing}[H]
+\caption{src\_unpack} \label{lst:src-unpack}
 \begin{verbatim}
 src_unpack() {
     if [[ -n ${A} ]]; then
@@ -122,6 +124,7 @@ src_unpack() {
     fi
 }
 \end{verbatim}
+\end{listing}
 
 \subsection{src\_prepare}
 \label{sec:src-prepare-function}
@@ -164,6 +167,8 @@ section~\ref{sec:s-to-workdir-fallback}.
 The \t{src\_configure} function configures the package's build environment. The default
 implementation used when the ebuild lacks the \t{src\_configure} function shall behave as:
 
+\begin{listing}[H]
+\caption{src\_configure} \label{lst:src-configure}
 \begin{verbatim}
 src_configure() {
     if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
@@ -171,6 +176,7 @@ src_configure() {
     fi
 }
 \end{verbatim}
+\end{listing}
 
 \ChangeWhenAddingAnEAPI{5}
 \begin{centertable}{EAPIs supporting \t{src\_configure}} \label{tab:src-configure-table}
@@ -202,6 +208,8 @@ section~\ref{sec:s-to-workdir-fallback}.
 0, the default implementation used when the ebuild lacks the \t{src\_compile} function shall behave
 as:
 
+\begin{listing}[H]
+\caption{src\_compile, format~0} \label{lst:src-compile-0}
 \begin{verbatim}
 src_compile() {
     if [[ -x ./configure ]]; then
@@ -212,11 +220,14 @@ src_compile() {
     fi
 }
 \end{verbatim}
+\end{listing}
 
 \featurelabel{src-compile-1} For EAPIs listed in table~\ref{tab:src-compile-table} as using format
 1, the default implementation used when the ebuild lacks the \t{src\_compile} function shall behave
 as:
 
+\begin{listing}[H]
+\caption{src\_compile, format~1} \label{lst:src-compile-1}
 \begin{verbatim}
 src_compile() {
     if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
@@ -227,11 +238,14 @@ src_compile() {
     fi
 }
 \end{verbatim}
+\end{listing}
 
 \featurelabel{src-compile-2} For EAPIs listed in table~\ref{tab:src-compile-table} as using format
 2, the default implementation used when the ebuild lacks the \t{src\_compile} function shall behave
 as:
 
+\begin{listing}[H]
+\caption{src\_compile, format~2} \label{lst:src-compile-2}
 \begin{verbatim}
 src_compile() {
     if [[ -f Makefile ]] || [[ -f GNUmakefile ]] || [[ -f makefile ]]; then
@@ -239,6 +253,7 @@ src_compile() {
     fi
 }
 \end{verbatim}
+\end{listing}
 
 \ChangeWhenAddingAnEAPI{5}
 \begin{centertable}{\t{src\_compile} behaviour for EAPIs} \label{tab:src-compile-table}
@@ -305,6 +320,8 @@ section~\ref{sec:s-to-workdir-fallback}.
 4, the default implementation used when the ebuild lacks the \t{src\_install} function shall behave
 as:
 
+\begin{listing}[H]
+\caption{src\_install, format~4} \label{lst:src-install-4}
 \begin{verbatim}
 src_install() {
     if [[ -f Makefile ]] || [[ -f GNUmakefile ]] || [[ -f makefile ]]; then
@@ -324,6 +341,7 @@ src_install() {
     fi
 }
 \end{verbatim}
+\end{listing}
 
 For other EAPIs, the default implementation used when the ebuild lacks the \t{src\_install} function
 is a no-op.
-- 
2.6.2

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-03 20:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-03 19:58 [gentoo-pms] Some formatting changes for algorithms and listings Ulrich Müller
2015-11-03 19:59 ` [gentoo-pms] [PATCH 1/3] pms.cls: More uniform style " Ulrich Müller
2015-11-03 20:01 ` [gentoo-pms] [PATCH 2/3] Inline all listing files. Fix verbatim environments Ulrich Müller
2015-11-03 20:03 ` [gentoo-pms] [PATCH 3/3] Move listings of ebuild functions into listing environments Ulrich Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox