[PATCH 2/6] styleguide: Add listing environment examples

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From f1ce3027b98c904b20eb3bf972d4494f1c76a517 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@xxxxxxxxx>
Date: Sat, 5 Aug 2017 18:43:01 +0900
Subject: [PATCH 2/6] styleguide: Add listing environment examples

Add two examples:

  1) Caption at the bottom
  2) "Ruled" style

Example 2) changes the looks by the float's "\restylefloat{}" macro.

Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx>
---
 appendix/styleguide/styleguide.tex | 52 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 50 insertions(+), 2 deletions(-)

diff --git a/appendix/styleguide/styleguide.tex b/appendix/styleguide/styleguide.tex
index bbd4b7f..8ebf9bf 100644
--- a/appendix/styleguide/styleguide.tex
+++ b/appendix/styleguide/styleguide.tex
@@ -592,7 +592,30 @@ The ``float'' package would be of help.\footnote{
   control of floating objects. However, because of an issue
   in two-column layout, we can not use it at the moment.}
 
-% TODO: Add example
+Figure~\ref{fig:app:styleguide:Sample Code Snippet}
+can be typeset as in
+Listing~\ref{lst:app:styleguide:Sample Code Snippet}
+using an experimental environment ``listing''.
+
+\begin{listing}
+{ \scriptsize
+\begin{verbbox}[\LstLineNo]
+/*
+ * Sample Code Snippet
+ */
+#include <stdio.h>
+int main(void)
+{
+  printf("Hello world!\n");
+  return 0;
+}
+\end{verbbox}
+}
+\centering
+\theverbbox
+\caption{Sample Code Snippet}
+\label{lst:app:styleguide:Sample Code Snippet}
+\end{listing}
 
 \subsubsection{Position of Caption}
 \label{sec:app:styleguide:Position of Caption}
@@ -607,7 +630,32 @@ top to bottom.
 The float package mentioned above also has the capability
 to adjust layout of caption.
 
-% TODO: Add example
+For code snippets, the ``ruled'' style would be our choice.
+Listing~\ref{lst:app:styleguide:Sample Code Snippet (Ruled)}
+is an example using the style.
+
+\floatstyle{ruled}
+\restylefloat{listing}
+
+\begin{listing}
+{ \scriptsize
+\begin{verbbox}[\LstLineNo]
+/*
+ * Sample Code Snippet
+ */
+#include <stdio.h>
+int main(void)
+{
+  printf("Hello world!\n");
+  return 0;
+}
+\end{verbbox}
+}
+\centering
+\theverbbox
+\caption{Sample Code Snippet (Ruled)}
+\label{lst:app:styleguide:Sample Code Snippet (Ruled)}
+\end{listing}
 
 Once the conversion of code sippets to a new environment has
 completed, we would be able to choose one of the style options
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe perfbook" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux