texlive[45963] Master/texmf-dist: sasnrdisplay (1dec17)

commits+karl at tug.org commits+karl at tug.org
Fri Dec 1 23:20:58 CET 2017


Revision: 45963
          http://tug.org/svn/texlive?view=revision&revision=45963
Author:   karl
Date:     2017-12-01 23:20:57 +0100 (Fri, 01 Dec 2017)
Log Message:
-----------
sasnrdisplay (1dec17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/sasnrdisplay/README
    trunk/Master/texmf-dist/doc/latex/sasnrdisplay/SASnRdisplay.pdf
    trunk/Master/texmf-dist/doc/latex/sasnrdisplay/SASnRdisplay.tex
    trunk/Master/texmf-dist/tex/latex/sasnrdisplay/SASnRdisplay.cfg
    trunk/Master/texmf-dist/tex/latex/sasnrdisplay/SASnRdisplay.sty

Modified: trunk/Master/texmf-dist/doc/latex/sasnrdisplay/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/sasnrdisplay/README	2017-12-01 22:20:43 UTC (rev 45962)
+++ trunk/Master/texmf-dist/doc/latex/sasnrdisplay/README	2017-12-01 22:20:57 UTC (rev 45963)
@@ -1,4 +1,4 @@
-% (C) Lars Madsen, daleif at imf.au.dk, 2012/10/10
+% (C) Lars Madsen, daleif at math.au.dk, 2017/12/01
 % This material is subject to the LaTeX Project Public License. 
 % See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html 
 % for the details of that license.
@@ -20,6 +20,13 @@
 
 HISTORY:
 
+2017/12/01
+
+* now requires a listings newer than 2015/06/04, so we have the R lang spec
+* Added R lang calls to the base R style
+* Added countbylistings option
+* A few extra things added to the manual (utf8)
+
 2014/03/07
 * bad test for \chapter, fix by using \ifundef instead
 
@@ -38,4 +45,4 @@
 
 
 /Lars Madsen
-daleif at imf.au.dk
+daleif at math.au.dk

Modified: trunk/Master/texmf-dist/doc/latex/sasnrdisplay/SASnRdisplay.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/sasnrdisplay/SASnRdisplay.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/sasnrdisplay/SASnRdisplay.tex	2017-12-01 22:20:43 UTC (rev 45962)
+++ trunk/Master/texmf-dist/doc/latex/sasnrdisplay/SASnRdisplay.tex	2017-12-01 22:20:57 UTC (rev 45963)
@@ -1,6 +1,6 @@
-% $LastChangedDate: 2012-03-27 12:21:37 +0200 (Tue, 27 Mar 2012) $
-% $LastChangedRevision: 1479 $
-% $LastChangedBy: daleif $
+% $LastChangedDate: 2017-12-01 15:08:05 +0100 (Fri, 01 Dec 2017) $
+% $LastChangedRevision: 1923 $
+% $LastChangedBy: daleif at math.au.dk $
 
 
 \documentclass[a4paper,article]{memoir}
@@ -33,7 +33,8 @@
 
 
 \newcommand\pkg{\texttt{SASnRdisplay}\xspace}
-%\setsecnumdepth{none}
+\setsecnumdepth{subsection}
+\settocdepth{subsection}
 \setsecheadstyle{\large\slshape\bfseries\memRTLraggedright}
 
 \usepackage[svgnames,dvipsnames]{xcolor}
@@ -118,7 +119,7 @@
 \newenvironment{question}[1]{
   \subsubsection*{\textnormal{\textit{\color{BrickRed}#1}}}
   \phantomsection
-  \addcontentsline{toc}{subsection}{#1}
+  \addcontentsline{toc}{subsubsection}{#1}
 }{}
 \lstnewenvironment{solution}[1][]{
   \lstset{style=Show,gobble=2,columns=fixed,#1}
@@ -125,15 +126,41 @@
 }{}
 
 
-\usepackage{hyperref}
+\usepackage[
+colorlinks,
+breaklinks,
+plainpages=false,
+pdfpagelabels,
+pdfencoding = auto,
+bookmarksnumbered,
+unicode,
+]{hyperref}
 
+
+\title{The \textsf{SASnRdisplay} package}
+\author{Lars Madsen\thanks{Email: daleif at math.au.dk, \SnRversion}}
+
+\definecolor{linkcolour}{rgb}{0,0.2,0.6}
+\definecolor{citecolour}{rgb}{0,0.6,0.2}
+\definecolor{urlcolour} {rgb}{0.8,0,0.8}
+
+
+\hypersetup{
+  pdftitle={The \textsf{SASnRdisplay} package},
+  pdfauthor={\copyright\ Lars Madsen 2017},
+  linkcolor=linkcolour,
+  citecolor=citecolour,
+  filecolor=urlcolour,
+  urlcolor=urlcolour,
+}
+
+
+
 \settocdepth{subsection}
 
 \pagestyle{plain}
 \begin{document}
 
-\title{The \textsf{SASnRdisplay} package}
-\author{Lars Madsen\thanks{Email: daleif at imf.au.dk,\SnRversion}}
 \maketitle
 
 \chapter*{Introdution}
@@ -264,6 +291,10 @@
 \item[consecutive] Use this if you just want consecutive
   numbering throughout, that is the number of say \SAS code, is not
   reset at every new chapter or section.
+\item[countbylistings] Here we will leave the counters alone and just
+  use the one that comes with \texttt{listings}. This (of course)
+  disables \texttt{countbysection}, \texttt{countbychapter} and
+  \texttt{consecutive}.
 \item[noautotitles-r, noautotitles-sas] Do not automatically add a
   number to any of the code and outputs. It can still be added
   manually by using the \texttt{caption=\marg{text}} option.
@@ -357,7 +388,7 @@
 style which is executed as the last style (and thus overwrites any
 former style).
 
-The settings can be seen in section~\ref{cha:defa-list-style}. The
+The settings can be seen in Section~\ref{cha:defa-list-style}. The
 styles are broken into smaller pieces. In some cases it make sense to
 change one of these smaller pieces, in other cases it is easier to
 add stuff to the provided \texttt{\meta{name}-\meta{type}-user}
@@ -374,7 +405,29 @@
 add all your setting for, say, \texttt{r-user}, into one single call
 to \cs{lstdefinestyle}.
 
-\subsection*{Colors}
+
+\subsection{Font}
+
+\begin{question}{I'd like to change the font size}
+  The gereral fontsize (not comments) is handled by the keyword
+  \texttt{basicstyle}, so you can change the font size for SAS code
+  in two ways,
+  \begin{solution}
+  \lstdefinestyle{sas-code-user}{
+    basicstyle=\ttfamily\footnotesize
+  }
+  \end{solution}
+  or by overwriting the default SAS code font setting:
+  \begin{solution}
+  \lstdefinestyle{sas-code-fonts}{
+    basicstyle = \ttfamily\small,
+  }
+  \end{solution}
+\end{question}
+
+
+
+\subsection{Colors}
 \label{sec:colors}
 
 The default colors are \texttt{SnRFrame} \showcolor{SnRFrame} for the
@@ -436,7 +489,7 @@
 
 
 
-\subsection*{Frames}
+\subsection{Frames}
 \label{sec:frames}
 
 Listings supports a number of different types of frames, see the
@@ -469,7 +522,7 @@
 
 \endgroup
 
-\subsection*{Captions}
+\subsection{Captions}
 \label{sec:captions-1}
 
 This is not a configuration as such but rather a hint to how one adds
@@ -538,7 +591,7 @@
 \end{question}
 
 
-\subsection*{Keywords}
+\subsection{Keywords}
 \label{sec:keywords}
 
 \begin{question}{In a presentaion, I'd like to highlight a word}
@@ -587,7 +640,7 @@
 \end{question}
 
 
-\subsection*{Escape to \LaTeX}
+\subsection{Escape to \LaTeX}
 \label{sec:escape-latex}
 
 This is a very handy feature and can e.g.\ be used to get formatted
@@ -615,11 +668,11 @@
 
 \fancybreak{}
 
-The \texttt{listings} manual, \cite[section~4.14]{listings} list other
+The \texttt{listings} manual, \cite[Section~4.14]{listings} list other
 features related to escaping back to normal \LaTeX\ formatting.
 
 
-\subsection*{Input encodings}
+\subsection{Input encodings (e.g. UTF8)}
 \label{sec:input-encodings}
 
 
@@ -626,48 +679,57 @@
 \begin{question}{I keep getting errors when I include my program,
     something about undefined chars!?}
 
-  There are two things at play here: firstly \texttt{listings} does
-  not support two-byte UTF8 (\texttt{listings} need to do a lot of
-  parsing, that and parsing may break when dealing with two-byte
-  UTF8), secondly one may have a situation where the main document
-  encoding is different from the encoding being used in code filers
-  being included.
+  The problem here is that \texttt{listings} cannot cope with so-called two two-byte characters,
+  \texttt{listings} needs to do a lot of parsing which may break when dealing with e.g. two-byte
+  UTF8 chars (essentially all non-acsii chars).
 
-  Let us try and handle the later first. We assume you are using the
-  \texttt{inputenc} package. Then one can specify that, say, all code
-  should be interpreted with, say, the \texttt{latin1} encoding. Here
-  is how for included \SAS code:
-  \begin{solution}
-    \lstdefinestyle{sas-include-code-user}{
-      inputencoding=latin1
-    }
-  \end{solution}
+  At the moment, no-one have made a UTF8 compatible version of \texttt{listings}, so we need to cope
+  somehow.
 
+  We will be assuming you are working with UTF8 files (both on the LaTeX side, and any including
+  source code), UTF8 is recommended nowadays, so we will ignore working purely in latin1 (which
+  \texttt{listings} has no issues with at all).
+
   \fancybreak{}
 
-  The other situation, i.e.\ the included\footnote{The solution is
-    only available for included files.} file is written in UTF8. Here
-  a solution exist if the two-byte UTF8 file, can safely be
-  transformed into a one-byte encoding such as \texttt{latin1}. And
-  example of this could be the situation with an \R file, written in
-  UTF8, including the Danish vowels \xE6\xF8\xE5, but other that those only US
-  ascii is being used. A file like this can easily be recoded as a
-  \texttt{latin1} based file.
-
-  There is a package (\texttt{listingsutf8}) can than handle this. It
-  extends the file inclusion feature and extend the input encoding
-  syntax. In the case described above, adding \texttt{listingsutf8} to
-  your preamble, and using 
+  First scenario: Assuming all your \texttt{listings} presented material comes from external
+  sources, e.g. they are inputted, and assuming your UTF8 sources code is compatible with the latin1
+  encoding (aka Western European languages), then you can simply additionally use the package
+  \texttt{listingsutf8}. It extends the file inclusion feature and extend the input encoding
+  syntax. Add \texttt{listingsutf8} to your preamble, and using
   \begin{solution}
     \lstdefinestyle{r-include-code-user}{
       inputencoding=utf8/latin1
     }
   \end{solution}
-  may solve the problem. See \cite{listingsutf8} for a bit more details. 
+  will attempt to auto convert the included code into latin1 before handing it off to
+  \texttt{listings}. See \cite{listingsutf8} for a bit more details. 
+ 
+  \fancybreak{}
+
+  Another solution, which works very well is using the the \texttt{literate} option. The value of
+  this key is read in triples, and is basically saying, if you see this char, typeset this
+  instead. Here is an example with the Danish \xE6\xF8\xE5:
+  \begin{solution}
+    \lstdefinestyle{r-code-user}{
+      literate={\xE6}{\ae}1%
+               {\xC6}{\AE}1%
+               {\xF8}{\o}1%
+               {\xD8}{\O}1%
+               {\xE5}{\aa}1%
+               {\xC5}{\AA}1,%  
+    }
+  \end{solution}
+  (add the comma after the last one). There are several examples on
+  \url{http://tex.stackexchange.com} if you search for
+  ``\texttt{listings literate}''.
+
+  As for the syntax of the triple: \marg{input}\marg{typeset output}\marg{length}.
+
 \end{question}
 
 
-\subsection*{Other}
+\subsection{Other}
 \label{sec:other}
 
 \begin{question}{I'd like to have line numbers}
@@ -804,9 +866,9 @@
 whereas
 
 \begin{SASoutput}
-                           TABLE OF NIVEAU BY FAG
+                           TABLE OF NIVEAU BY SUBJECT
 
-           NIVEAU     FAG
+           NIVEAU     SUBJECT
 
            Frequency|
            Percent  |
@@ -836,9 +898,9 @@
 comes from
 \begin{Show}
 \begin{SASoutput}
-                           TABLE OF NIVEAU BY FAG
+                           TABLE OF NIVEAU BY SUBJECT
 
-           NIVEAU     FAG
+           NIVEAU     SUBJECT
 
            Frequency|
            Percent  |
@@ -938,6 +1000,8 @@
 for things that are emphasized.
 \getsniplet{rcharsandbreaks}{\texttt{r-chars-and-breaks}}
 \getsniplet{rmarkup}{\texttt{r-markup}}
+\R lang setting was added 2017/12/01 and requires a \texttt{listings}
+newer from 2015 or later.
 \getsniplet{rframe}{\texttt{r-frame}}
 \getsniplet{rcolors}{\texttt{r-colors}}
 \noindent
@@ -951,6 +1015,10 @@
 Note that by default, the inline style for \verb|\Rinline|, shares
 nothing with the rest of the \R configuration and is loaded on its own.
 
+\R lang setting was added 2017/12/01 and requires a \texttt{listings}
+newer from 2015 or later.
+
+
 \subsection{\R user styles}
 \label{sec:user-styles}
 
@@ -1050,7 +1118,7 @@
 
 
 
-\subsection*{Extra SAS keywords}
+\subsection{Extra SAS keywords}
 \label{sec:extra-sas-keywords}
 
 J\xF8rgen Granfeldt supplied extra \SAS keywords to supplement those
@@ -1073,20 +1141,20 @@
 \begin{thebibliography}{9}
 \RaggedRight
 \bibitem{xcolor} Uwe Kern, \emph{Extending \LaTeX's color facilities:
-    the \textsf{xcolor} package}, 2006.
+    the \textsf{xcolor} package}, 2016.
   \addCTAN{/macros/latex/contrib/xcolor/}.
 
 \bibitem{listings} Various, \emph{The \textsf{listings} Package},
-  1996--2007.  \addCTAN{/macros/latex/contrib/listings/}.
+  1996--2015.  \addCTAN{/macros/latex/contrib/listings/}.
 
 \bibitem{etoolbox}
-  Philipp Lehman,
+  Philipp Lehman, Joseph Wright,
 \emph{The etoolbox Package -- An e-TeX Toolbox for Class and Package
-  Authors}, 2011. \addCTAN{/macros/latex/contrib/listings/etoolbox}.
+  Authors}, 2017. \addCTAN{/macros/latex/contrib/listings/etoolbox}.
 
 
 \bibitem{listingsutf8}
-  Heiko Oberdiek, \emph{The \textsf{listingsutf8} package}, 2007.
+  Heiko Oberdiek, \emph{The \textsf{listingsutf8} package}, 2016.
   \addCTAN{/macros/latex/contrib/oberdiek/}.
 
 \bibitem{caption} Axel Sommerfelt, \emph{Customizing captions of

Modified: trunk/Master/texmf-dist/tex/latex/sasnrdisplay/SASnRdisplay.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/latex/sasnrdisplay/SASnRdisplay.cfg	2017-12-01 22:20:43 UTC (rev 45962)
+++ trunk/Master/texmf-dist/tex/latex/sasnrdisplay/SASnRdisplay.cfg	2017-12-01 22:20:57 UTC (rev 45963)
@@ -10,8 +10,8 @@
 %% 
 %% This work has the LPPL maintenance status "maintained".
 %% 
-%% The Current Maintainer of this work is Lars Madsen (daleif at imf.au.dk) 
-%% Data supplied by J\o rgen Granfeldt (jqrgen at imf.au.dk)
+%% The Current Maintainer of this work is Lars Madsen (daleif at math.au.dk) 
+%% Data supplied by J\o rgen Granfeldt (jqrgen at math.au.dk)
 %%
 % how to use:
 %

Modified: trunk/Master/texmf-dist/tex/latex/sasnrdisplay/SASnRdisplay.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/sasnrdisplay/SASnRdisplay.sty	2017-12-01 22:20:43 UTC (rev 45962)
+++ trunk/Master/texmf-dist/tex/latex/sasnrdisplay/SASnRdisplay.sty	2017-12-01 22:20:57 UTC (rev 45963)
@@ -1,10 +1,10 @@
-\ProvidesPackage{SASnRdisplay}[2014/03/07 v0.93 by daleif]
+\ProvidesPackage{SASnRdisplay}[2017/12/01 v0.95 by daleif]
 
-\newcommand\SnRversion{v0.93 2014/03/07}
+\newcommand\SnRversion{v0.95 2017/12/01}
 
-%% $LastChangedDate: 2012-10-15 16:01:29 +0200 (Mon, 15 Oct 2012) $
-%% $LastChangedRevision: 1552 $
-%% $LastChangedBy: daleif $
+%% $LastChangedDate: 2017-12-01 15:09:40 +0100 (Fri, 01 Dec 2017) $
+%% $LastChangedRevision: 1924 $
+%% $LastChangedBy: daleif at math.au.dk $
 
 %%
 %% This package can be distributed and/or modified under the
@@ -17,12 +17,12 @@
 %% 
 %% This work has the LPPL maintenance status "maintained".
 %% 
-%% The Current Maintainer of this work is Lars Madsen (daleif at imf.au.dk).
+%% The Current Maintainer of this work is Lars Madsen (daleif at math.au.dk).
 %%
 
 
 
-\RequirePackage{listings}
+\RequirePackage{listings}[2015/06/04]
 \RequirePackage{xkeyval,xcolor,etoolbox,caption,needspace}
 
 
@@ -100,6 +100,7 @@
 \newtoggle{SnRcountbysection}
 \newtoggle{SnRcountbychapter}
 \newtoggle{SnRcountconsecutive}
+\newtoggle{SnRcountbylistings}
 \DeclareOptionX{consecutive}{\toggletrue{SnRcountconsecutive}}
 \DeclareOptionX{countbysection}{\toggletrue{SnRcountbysection}}
 \DeclareOptionX{countbychapter}{%
@@ -111,6 +112,12 @@
   }
 }
 
+
+% added 2017/12/01 in response to 
+% https://tex.stackexchange.com/q/181110/3929
+\DeclareOptionX{countbylistings}{\toggletrue{SnRcountbylistings}}
+
+
 \let\SnRneedspaceCommand\@gobble
 \newlength\SnRneedspace
 \let\SnRneedspaceSAScode  \SnRneedspace
@@ -225,26 +232,33 @@
   \dolistloop\SnRtypes
 }
 
+% added 2017/12/01, if option given, then don't create or mess with counters
+\iftoggle{SnRcountbylistings}{}{
 
-\iftoggle{SnRcountconsecutive}{
-  \SnRsetupcounters{}% no dominant counter
-}{
-  \iftoggle{SnRcountbysection}{
-  \SnRsetupcounters{section}
-  }{ % must be after chapter
-  \SnRsetupcounters{chapter}
+  \iftoggle{SnRcountconsecutive}{
+    \SnRsetupcounters{}% no dominant counter
+  }{
+    \iftoggle{SnRcountbysection}{
+      \SnRsetupcounters{section}
+    }{ % must be after chapter
+      \SnRsetupcounters{chapter}
+    }
   }
+
 }
 
-
 % This is inspired from the memoir class, it enables us to alias the
 % listings counter such that we can have different series
 % It will locally make one counter behave like another counter
 % it also handles the \the<counter>
-\newcommand*{\SnRletcountercounter}[2]{%
-   \csletcs{c@#1}{c@#2}
-   \csletcs{the#1}{the#2}
-   \SnRHrefNumber{#2}
+\iftoggle{SnRcountbylistings}{
+  \let\SnRletcountercounter\@gobbletwo
+}{
+  \newcommand*{\SnRletcountercounter}[2]{%
+    \csletcs{c@#1}{c@#2}
+    \csletcs{the#1}{the#2}
+    \SnRHrefNumber{#2}
+  }
 }
 
 
@@ -345,7 +359,8 @@
 % this is for basic configuration of the inline version
 % rinline
 \lstdefinestyle{r-inline}{
-  basicstyle = \ttfamily
+  basicstyle = \ttfamily,
+  language  = R, % R lang added 2017/12/01
 }
 % end rinline
 % Spaces above and after, plus caption and internal lineskip (note
@@ -380,9 +395,12 @@
   extendedchars = true,   % special chars allowed, be aware of utf8
 }
 % end rcharsandbreaks
+
+  %morecomment  = [s]{\#}{\^^M},  % comment from # to the end of the line
+
 % rmarkup
-\lstdefinestyle{r-markup}{       % this only make sense for code
-  morecomment  = [s]{\#}{\^^M},  % comment from # to the end of the line
+\lstdefinestyle{r-markup}{        % this only make sense for code
+  language     = R,               % R lang added 2017/12/01
   commentstyle = \normalfont\slshape\ttfamily\footnotesize,
 }
 % end rmarkup



More information about the tex-live-commits mailing list