Skip to contentSkip to conversation

Use \tco{} macro within caption and section header

PATCH In review Akira Yokosawa 2 participants 5 messages Mar 7, 2017

lore
Share & tools
lore
#0 lore raw

cover Use \tco{} macro within caption and section header

From a51c44bef0dbc05bd95391ac3f8f0f2d26becbf5 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 7 Mar 2017 23:35:32 +0900
Subject: [PATCH 0/3] Use \tco{} macro within caption and section header

Hi Paul,

This is the 1st patch set I have tested locally for a while. The objectives of this and the following patch sets are as follows:

o Use \tco{} macro within caption and section header
o Use modern packages such as enumitem
o Convert itemize or enumerate lists to description lists
o Add another alternative monospace font target

This set corresponds to the 1st one.
Patch 1 is an independent change to manage "microtype".

Thanks, Akira.
--
Akira Yokosawa (3):
perfbook.tex: Disable 'microtype' for typewriter font
treewide: Use \tco{} for api name in caption
treewide: Use \tco{} for api name in subsubsection title

 appendix/whymb/whymemorybarriers.tex |  2 +-
 debugging/debugging.tex              |  2 +-
 future/tm.tex                        |  2 +-
 locking/locking.tex                  |  8 ++++----
 perfbook.tex                         |  4 +---
 together/refcnt.tex                  |  6 +++---
 toolsoftrade/toolsoftrade.tex        | 38 ++++++++++++++++++------------------
 7 files changed, 30 insertions(+), 32 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/3 perfbook.tex: Disable 'microtype' for typewriter font

From ea338159985ecf9d28a91607111a76e593b4fed6 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 7 Mar 2017 21:04:50 +0900
Subject: [PATCH 1/3] perfbook.tex: Disable 'microtype' for typewriter font

In commit 2c2645db78f0 ("Disable 'microtype' in code snippets"), microtype was disabled in verbatim and verbbox environments. Instead of patching those environments, this commit use \UseMicrotypeSet{} command to exclude tt font from protrusion.

This change prevents protrusion of "-" within \co{} after line break as was observed in Section 12.1.2.

---
 perfbook.tex | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
perfbook.tex +1 -3
index 324c708..d532e65 100644
@@ -13,9 +13,7 @@
 
 % Improves the text layout
 \usepackage{microtype}
-\usepackage{etoolbox}
-\AtBeginEnvironment{verbatim}{\microtypesetup{activate=false}}
-\AtBeginEnvironment{verbbox}{\microtypesetup{activate=false}}
+\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
 
 \usepackage{lscape}
 \usepackage{epsfig}
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/3 treewide: Use \tco{} for api name in caption

In reply to Akira Yokosawa

From 7c0c10ba897e0c2830a8cc965d8dde00fb018179 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 7 Mar 2017 21:05:40 +0900
Subject: [PATCH 2/3] treewide: Use \tco{} for api name in caption

In caption of Figure 4.5, "pthread_create()" was written as {\tt pthread\_create()}.
"\tco{}" macro added in commit bf816541d234 ("Define \tco{} command to be used in table") can be safely used inside \caption{}. By using \tco{}, api names inside captions can be easily found by searching them in latex sources.

This commit makes use of \tco{} in such cases treewide.

---
 appendix/whymb/whymemorybarriers.tex | 2 +-
 debugging/debugging.tex              | 2 +-
 locking/locking.tex                  | 6 +++---
 together/refcnt.tex                  | 6 +++---
 toolsoftrade/toolsoftrade.tex        | 8 ++++----
 5 files changed, 12 insertions(+), 12 deletions(-)
appendix/whymb/whymemorybarriers.tex +1 -1
index 7748c66..6e96af4 100644
@@ -1848,7 +1848,7 @@ or, again, if you think that I am just making all this up.\footnote{
 	\put(45,25){\makebox(120,20)[c]{Interconnect}}
 
 \end{picture}
-\caption{Why smp\_read\_barrier\_depends() is Required}
+\caption{Why \tco{smp_read_barrier_depends()} is Required}
 \label{fig:app:whymb:Why smp-read-barrier-depends() is Required}
 \end{figure}
 
debugging/debugging.tex +1 -1
index adaa32f..86b1118 100644
@@ -2056,7 +2056,7 @@ Similarly, interrupt-based interference can be detected via the
 }
 \centering
 \theverbbox
-\caption{Using getrusage() to Detect Context Switches}
+\caption{Using \tco{getrusage()} to Detect Context Switches}
 \label{fig:count:Using getrusage() to Detect Context Switches}
 \end{figure}
 
locking/locking.tex +3 -3
index 9cf945f..7b19e84 100644
@@ -288,14 +288,14 @@ locks before invoking the comparison function.
 \begin{figure}[tb]
 \centering
 \resizebox{3in}{!}{\includegraphics{locking/NonLocalLockHierarchy}}
-\caption{Without Local Locking Hierarchy for qsort()}
+\caption{Without Local Locking Hierarchy for \tco{qsort()}}
 \label{fig:lock:Without Local Locking Hierarchy for qsort()}
 \end{figure}
 
 \begin{figure}[tb]
 \centering
 \resizebox{3in}{!}{\includegraphics{locking/LocalLockHierarchy}}
-\caption{Local Locking Hierarchy for qsort()}
+\caption{Local Locking Hierarchy for \tco{qsort()}}
 \label{fig:lock:Local Locking Hierarchy for qsort()}
 \end{figure}
 
@@ -342,7 +342,7 @@ improves modularity.
 \begin{figure}[tb]
 \centering
 \resizebox{3in}{!}{\includegraphics{locking/LayeredLockHierarchy}}
-\caption{Layered Locking Hierarchy for qsort()}
+\caption{Layered Locking Hierarchy for \tco{qsort()}}
 \label{fig:lock:Layered Locking Hierarchy for qsort()}
 \end{figure}
 
together/refcnt.tex +3 -3
index 267cd9f..e7884a4 100644
@@ -281,7 +281,7 @@ RCU read-side critical sections.
 }
 \centering
 \theverbbox
-\caption{Linux Kernel kref API}
+\caption{Linux Kernel \tco{kref} API}
 \label{fig:together:Linux Kernel kref API}
 \end{figure}
 
@@ -383,7 +383,7 @@ shown in Figure~\ref{fig:together:Linux Kernel dst-clone API}.
 }
 \centering
 \theverbbox
-\caption{Linux Kernel dst\_clone API}
+\caption{Linux Kernel \tco{dst_clone} API}
 \label{fig:together:Linux Kernel dst-clone API}
 \end{figure}
 
@@ -493,7 +493,7 @@ Figure~\ref{fig:together:Linux Kernel fget/fput API}.
 }
 \centering
 \theverbbox
-\caption{Linux Kernel fget/fput API}
+\caption{Linux Kernel \tco{fget}/\tco{fput} API}
 \label{fig:together:Linux Kernel fget/fput API}
 \end{figure}
 
toolsoftrade/toolsoftrade.tex +4 -4
index 0d1bf8c..30e7067 100644
@@ -206,7 +206,7 @@ subject~\cite{WRichardStevens1992,StewartWeiss2013UNIX}.
 }
 \centering
 \theverbbox
-\caption{Using the fork() Primitive}
+\caption{Using the \tco{fork()} Primitive}
 \label{fig:toolsoftrade:Using the fork() Primitive}
 \end{figure}
 
@@ -250,7 +250,7 @@ process ID of the child.
 }
 \centering
 \theverbbox
-\caption{Using the wait() Primitive}
+\caption{Using the \tco{wait()} Primitive}
 \label{fig:toolsoftrade:Using the wait() Primitive}
 \end{figure}
 
@@ -312,7 +312,7 @@ Otherwise, lines~11 and 12 print an error and exit.
 }
 \centering
 \theverbbox
-\caption{Processes Created Via fork() Do Not Share Memory}
+\caption{Processes Created Via \tco{fork()} Do Not Share Memory}
 \label{fig:toolsoftrade:Processes Created Via fork() Do Not Share Memory}
 \end{figure}
 
@@ -418,7 +418,7 @@ is the argument that will be passed to \co{mythread}.
 }
 \centering
 \theverbbox
-\caption{Threads Created Via {\tt pthread\_create()} Share Memory}
+\caption{Threads Created Via \tco{pthread_create()} Share Memory}
 \label{fig:toolsoftrade:Threads Created Via pthread-create() Share Memory}
 \end{figure}
 
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/3 treewide: Use \tco{} for api name in subsubsection title

In reply to Akira Yokosawa

From a51c44bef0dbc05bd95391ac3f8f0f2d26becbf5 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 7 Mar 2017 21:06:17 +0900
Subject: [PATCH 3/3] treewide: Use \tco{} for api name in subsubsection title

\tco{} is also safe in section title.
Do the same changes as the previous commit for api names in subsubsection titles.

---
 future/tm.tex                 |  2 +-
 locking/locking.tex           |  2 +-
 toolsoftrade/toolsoftrade.tex | 30 +++++++++++++++---------------
 3 files changed, 17 insertions(+), 17 deletions(-)
future/tm.tex +1 -1
index 80aabf4..93aece5 100644
@@ -429,7 +429,7 @@ That said, there are rumors that some TM researchers are investigating
 fork/join parallelism within transactions, so perhaps this topic will
 soon be addressed more thoroughly.
 
-\subsubsection{The exec() System Call}
+\subsubsection{The \tco{exec()} System Call}
 \label{sec:future:The exec System Call}
 
 One can execute an \co{exec()} system call while holding a lock, and
locking/locking.tex +1 -1
index 7b19e84..562ff09 100644
@@ -2173,7 +2173,7 @@ checker~\cite{JonathanCorbet2006lockdep}.
 One of the great strengths of lockdep is that it is not fooled by
 human intuition~\cite{StevenRostedt2011locdepCryptic}.
 
-\subsubsection{Library Functions Used Between fork() and exec()}
+\subsubsection{Library Functions Used Between \tco{fork()} and \tco{exec()}}
 \label{sec:locking:Library Functions Used Between fork() and exec()}
 
 As noted earlier, if a thread executing a library function is holding
toolsoftrade/toolsoftrade.tex +15 -15
index 30e7067..c225bee 100644
@@ -1424,7 +1424,7 @@ void wait_all_threads(void)
 \label{fig:toolsoftrade:Thread API}
 \end{figure*}
 
-\subsubsection{create\_thread()}
+\subsubsection{\tco{create_thread()}}
 
 The \co{create_thread()} primitive creates a new thread,
 starting the new thread's execution
@@ -1443,7 +1443,7 @@ the program.
 though some systems may have an upper bound for the allowable number
 of threads.
 
-\subsubsection{smp\_thread\_id()}
+\subsubsection{\tco{smp_thread_id()}}
 
 Because the \co{thread_id_t} returned from \co{create_thread()} is
 system-dependent, the \co{smp_thread_id()} primitive returns a thread
@@ -1453,21 +1453,21 @@ that have been in existence since the program started,
 and is therefore useful for bitmasks, array indices, and
 the like.
 
-\subsubsection{for\_each\_thread()}
+\subsubsection{\tco{for_each_thread()}}
 
 The \co{for_each_thread()} macro loops through all threads that exist,
 including all threads that \emph{would} exist if created.
 This macro is useful for handling per-thread variables as will be
 seen in Section~\ref{sec:toolsoftrade:Per-Thread Variables}.
 
-\subsubsection{for\_each\_running\_thread()}
+\subsubsection{\tco{for_each_running_thread()}}
 
 The \co{for_each_running_thread()}
 macro loops through only those threads that currently exist.
 It is the caller's responsibility to synchronize with thread
 creation and deletion if required.
 
-\subsubsection{wait\_thread()}
+\subsubsection{\tco{wait_thread()}}
 
 The \co{wait_thread()} primitive waits for completion of the thread
 specified by the \co{thread_id_t} passed to it.
@@ -1476,7 +1476,7 @@ instead, it merely waits for it.
 Note that \co{wait_thread()} returns the value that was returned by
 the corresponding thread.
 
-\subsubsection{wait\_all\_threads()}
+\subsubsection{\tco{wait_all_threads()}}
 
 The \co{wait_all_threads()}
 primitive waits for completion of all currently running threads.
@@ -1591,13 +1591,13 @@ void spin_unlock(spinlock_t *sp);
 \label{fig:toolsoftrade:Locking API}
 \end{figure}
 
-\subsubsection{spin\_lock\_init()}
+\subsubsection{\tco{spin_lock_init()}}
 
 The \co{spin_lock_init()} primitive initializes the specified
 \co{spinlock_t} variable, and must be invoked before
 this variable is passed to any other spinlock primitive.
 
-\subsubsection{spin\_lock()}
+\subsubsection{\tco{spin_lock()}}
 
 The \co{spin_lock()} primitive acquires the specified spinlock,
 if necessary, waiting until the spinlock becomes available.
@@ -1608,14 +1608,14 @@ in others, such as the Linux kernel, it will involve blocking.
 The key point is that only one thread may hold a spinlock at any
 given time.
 
-\subsubsection{spin\_trylock()}
+\subsubsection{\tco{spin_trylock()}}
 
 The \co{spin_trylock()} primitive acquires the specified spinlock,
 but only if it is immediately available.
 It returns \co{true} if it was able to acquire the spinlock and
 \co{false} otherwise.
 
-\subsubsection{spin\_unlock()}
+\subsubsection{\tco{spin_unlock()}}
 
 The \co{spin_unlock()} primitive releases the specified spinlock,
 allowing other threads to acquire it.
@@ -1753,7 +1753,7 @@ init_per_thread(name, v)
 	not they were C static variables!
 } \QuickQuizEnd
 
-\subsubsection{DEFINE\_PER\_THREAD()}
+\subsubsection{\tco{DEFINE_PER_THREAD()}}
 
 The \co{DEFINE_PER_THREAD()} primitive defines a per-thread variable.
 Unfortunately, it is not possible to provide an initializer in the way
@@ -1761,22 +1761,22 @@ permitted by the Linux kernel's \co{DEFINE_PER_THREAD()} primitive,
 but there is an \co{init_per_thread()} primitive that permits easy
 runtime initialization.
 
-\subsubsection{DECLARE\_PER\_THREAD()}
+\subsubsection{\tco{DECLARE_PER_THREAD()}}
 
 The \co{DECLARE_PER_THREAD()} primitive is a declaration in the C sense,
 as opposed to a definition.
 Thus, a \co{DECLARE_PER_THREAD()} primitive may be used to access
 a per-thread variable defined in some other file.
 
-\subsubsection{per\_thread()}
+\subsubsection{\tco{per_thread()}}
 
 The \co{per_thread()} primitive accesses the specified thread's variable.
 
-\subsubsection{\_\_get\_thread\_var()}
+\subsubsection{\tco{__get_thread_var()}}
 
 The \co{__get_thread_var()} primitive accesses the current thread's variable.
 
-\subsubsection{init\_per\_thread()}
+\subsubsection{\tco{init_per_thread()}}
 
 The \co{init_per_thread()} primitive sets all threads' instances of
 the specified variable to the specified value.
Signature · 1 line
2.7.4
#4 lore raw
In reply to Akira Yokosawa
Quoted 10 lines · Akira Yokosawa
Quoted 1 line

From a51c44bef0dbc05bd95391ac3f8f0f2d26becbf5 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Tue, 7 Mar 2017 23:35:32 +0900
Subject: [PATCH 0/3] Use \tco{} macro within caption and section header

Hi Paul,

This is the 1st patch set I have tested locally for a while. The objectives of this and the following patch sets are as follows:

Quoted 7 lines

o Use \tco{} macro within caption and section header
o Use modern packages such as enumitem
o Convert itemize or enumerate lists to description lists
o Add another alternative monospace font target

This set corresponds to the 1st one.
Patch 1 is an independent change to manage "microtype".

Much nicer! Also makes it easier to search the .tex files for symbol names containing underscore. Queued and pushed, thank you!

Thanx, Paul

Quoted 19 lines

Thanks, Akira.
--
Akira Yokosawa (3):
perfbook.tex: Disable 'microtype' for typewriter font
treewide: Use \tco{} for api name in caption
treewide: Use \tco{} for api name in subsubsection title

 appendix/whymb/whymemorybarriers.tex |  2 +-
 debugging/debugging.tex              |  2 +-
 future/tm.tex                        |  2 +-
 locking/locking.tex                  |  8 ++++----
 perfbook.tex                         |  4 +---
 together/refcnt.tex                  |  6 +++---
 toolsoftrade/toolsoftrade.tex        | 38 ++++++++++++++++++------------------
 7 files changed, 30 insertions(+), 32 deletions(-)
Signature · 1 line
2.7.4