[PATCH 4/5] styleguide: Add example of options to \num{} command

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

 



>From 5a9c793796655ca1be1505d544604cd059fd4a48 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@xxxxxxxxx>
Date: Sat, 12 Aug 2017 18:30:34 +0900
Subject: [PATCH 4/5] styleguide: Add example of options to \num{} command

Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx>
---
 appendix/styleguide/styleguide.tex | 46 ++++++++++++++++++++++++++++++++++++--
 perfbook.tex                       |  1 +
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/appendix/styleguide/styleguide.tex b/appendix/styleguide/styleguide.tex
index c90bbe7..0ab9e68 100644
--- a/appendix/styleguide/styleguide.tex
+++ b/appendix/styleguide/styleguide.tex
@@ -242,8 +242,8 @@ in math mode by default.\footnote{
   See \url{https://tex.stackexchange.com/questions/119248/}
   for the historical reason.}
 
-\subsubsection{Digit Spacing}
-\label{sec:app:styleguide:Digit Spacing}
+\subsubsection{Digit Grouping}
+\label{sec:app:styleguide:Digit Grouping}
 
 Quote from NIST check list:\footnote{
   \#16 in \url{http://physics.nist.gov/cuu/Units/checklist.html}.
@@ -266,6 +266,48 @@ Quote from NIST check list:\footnote{
 In \LaTeX\ coding, it is cumbersome to place thin spaces as are recommended
 in NIST guide. The \verb|\num{}| command provided by the ``siunitx''
 package would be of help for us to follow this rule.
+It would also help us overcome different conventions.
+We can select a specific digit-grouping style as
+a default in preamble, or specify an option to each \verb|\num{}|
+command as is shown in
+Table~\ref{tab:app:styleguide:Digit-Grouping Style}.
+
+\newcommand{\NumDigitGrpA}{12 345}
+\newcommand{\NumDigitGrpB}{12.345}
+\newcommand{\NumDigitGrp}{1 234 567.89}
+\begin{table}[htbp]
+\small\centering
+\begin{tabular}{lrrr}\toprule
+  Style & \multicolumn{3}{c}{Outputs of \co{\\num\{\}}} \\
+  \midrule
+  NIST/SI (English) & \num{\NumDigitGrpA} & \num{\NumDigitGrpB} & \num{\NumDigitGrp} \\
+  SI (French) & \num[locale=FR]{\NumDigitGrpA} &
+    \num[locale=FR]{\NumDigitGrpB} & \num[locale=FR]{\NumDigitGrp} \\
+  English & \num[group-separator={,},group-digits=integer]{\NumDigitGrpA} &
+    \num[group-separator={,},group-digits=integer]{\NumDigitGrpB} &
+      \num[group-separator={,},group-digits=integer]{\NumDigitGrp} \\
+  French & \num[locale=FR]{\NumDigitGrpA} &
+    \num[locale=FR]{\NumDigitGrpB} & \num[locale=FR]{\NumDigitGrp} \\
+  Other Europe & \num[group-separator={.},output-decimal-marker={,},group-digits=integer]{\NumDigitGrpA} &
+    \num[group-separator={.},output-decimal-marker={,},group-digits=integer]{\NumDigitGrpB} &
+      \num[group-separator={.},output-decimal-marker={,},group-digits=integer]{\NumDigitGrp} \\
+\bottomrule
+\end{tabular}
+\caption{Digit-Grouping Style}
+\label{tab:app:styleguide:Digit-Grouping Style}
+\end{table}
+
+As are evident in
+Table~\ref{tab:app:styleguide:Digit-Grouping Style},
+periods and commas used as other than decimal markers are confusing
+and should be avoided, especially in documents expecting global
+audiences.
+
+By marking up constant decimal values by \verb|\num{}| commands,
+the \LaTeX\ source would be exempted from any particular conventions.
+
+Because of its open-source policy, this approach should give
+more ``portability'' to perfbook.
 
 \section{\LaTeX\ Conventions}
 \label{sec:app:styleguide:LaTeX Conventions}
diff --git a/perfbook.tex b/perfbook.tex
index f8421ca..9f1644d 100644
--- a/perfbook.tex
+++ b/perfbook.tex
@@ -53,6 +53,7 @@
 \setlength{\epigraphwidth}{2.6in}
 \usepackage[xspace]{ellipsis}
 \usepackage{braket} % for \ket{} macro in QC section
+\usepackage{siunitx} % for \num{} macro
 
 % custom packages
 
-- 
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