texlive[44154] Master/texmf-dist: varsfromjobname (2may17)

commits+karl at tug.org commits+karl at tug.org
Tue May 2 23:41:13 CEST 2017


Revision: 44154
          http://tug.org/svn/texlive?view=revision&revision=44154
Author:   karl
Date:     2017-05-02 23:41:13 +0200 (Tue, 02 May 2017)
Log Message:
-----------
varsfromjobname (2may17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.pdf
    trunk/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.tex
    trunk/Master/texmf-dist/tex/latex/varsfromjobname/varsfromjobname.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/varsfromjobname/README.md

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/varsfromjobname/README

Deleted: trunk/Master/texmf-dist/doc/latex/varsfromjobname/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/varsfromjobname/README	2017-05-02 21:11:59 UTC (rev 44153)
+++ trunk/Master/texmf-dist/doc/latex/varsfromjobname/README	2017-05-02 21:41:13 UTC (rev 44154)
@@ -1,40 +0,0 @@
-README
----------
-
-varsfromjobname.sty is based on code by supplied by Friedrich Vosberg and Markus Kohm,  help from Rolf Niepraschk, Sven Naumann, Ulrich Schwarz 
-and Andreas Mathias was greatly appreciated. The package extracts variables from the name of the LaTeX file.
-
-If the name of the file consists of tokens separated by hyphen, the package offers the following commands:  
-
-\getfromjobname{<param>} with <param> in the range of 1 to 9, which calls one of the following commands then, also available:
-
-\getonefromjobname 
-\gettwofromjobname 
-\getthreefromjobname 
-\getfourfromjobname 
-\getfivefromjobname 
-\getsixfromjobname 
-\getsevenfromjobname 
-\geteightfromjobname 
-\getninefromjobname  
-
-Usage:  
-
-a) Save your LaTeX-file under a name such as 2008-04-14-ziegenhagen.tex
-
-b) Load the package by putting \usepackage{varsfromjobname} in the preamble of 
-   your document  
-
-c) Use the commands given above to address the specific parts of the filename.
-
-d) Adressing a token which is not available gives an error, so make sure to request
-   only those tokens that are actually available.
-
-If you find this package useful, feel free to give me feedback: <http://www.uweziegenhagen.de>
-
-Version History:
-
-v0.5: Fixed a bug by inserting % at the right place. Thanks, Rolf.
-
-
-Uwe Ziegenhagen, 2009-01-11
\ No newline at end of file

Added: trunk/Master/texmf-dist/doc/latex/varsfromjobname/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/varsfromjobname/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/varsfromjobname/README.md	2017-05-02 21:41:13 UTC (rev 44154)
@@ -0,0 +1,65 @@
+# VarsFromJobname
+
+Sources for my varsfromjobname LaTeX package, available also from CTAN: 
+
+[https://www.ctan.org/tex-archive/macros/latex/contrib/varsfromjobname](https://www.ctan.org/tex-archive/macros/latex/contrib/varsfromjobname "CTAN varsfromjobname")
+
+# Credits
+
+varsfromjobname.sty is based on code by supplied by Friedrich Vosberg, Enrico Gregorio and Markus Kohm,  help from Rolf Niepraschk, Sven Naumann, Ulrich Schwarz 
+and Andreas Mathias was greatly appreciated.
+
+# What does this package do?
+
+Using `varsfromjobname.sty` one can easily extract information from the filename, if it follows a certain form. 
+
+The standard LaTeX command `\jobname` returns the name of the LaTeX (master) file. If the filename consists of tokens separated by hyphen we can easily extract certain tokens that can be used _inside_ the document. 
+
+The package expects the filename to be of the form
+`one-two-three-four-five-six-seven-eight-nine.tex` and offers the following commands:
+
+* `\getfromjobname{param}`, with `param` in the range of 1 to 9 (a highlevel
+interface to the following commands)
+* `\getonefromjobname`
+* `\gettwofromjobname`
+* `\getthreefromjobname`
+* `\getfourfromjobname`
+* `\getfivefromjobname`
+* `\getsixfromjobname`
+* `\getsevenfromjobname`
+* `\geteightfromjobname`
+* `\getninefromjobname`
+
+# Why can it be useful?
+
+
+You can use this package for example to define the date of the document in the filename, personally I use it e.g. for `scrlttr2` letters.
+
+# Shortcomings
+
+* `\getfromjobname` is not fully expandable, use one of the other commands if you need expansion
+* Version 1.0 cannot extract information from included sub-documents
+* The package cannot handle more than nine tokens, see the reference to egreg's answer on TSX below for an updated version
+
+# References
+
+* [https://tex.stackexchange.com/questions/212169/qr-code-from-jobname/212171#212171](https://tex.stackexchange.com/questions/212169/qr-code-from-jobname/212171#212171 "QR-code from jobname")
+
+Remark: [egreg](https://tex.stackexchange.com/users/4427/egreg "egreg") gave an improved version of the code written with expl3 which also overcomes the limitation of nine parameters.
+
+* [https://tex.stackexchange.com/questions/116755/timestamp-in-document-pdf-name/116805#116805](https://tex.stackexchange.com/questions/116755/timestamp-in-document-pdf-name/116805#116805 "Timestamp in document / pdf name")
+
+* German article in the DTK on pagewise versioning with Subversion (to be published)
+
+
+# Change History
+
+- Version 0.5, as of January 11th 2009: Initial version published
+
+- Version 1.0, to be published May 2017: 
+	- Added various commands which extract necessary information also from included documents
+	- Modified code as suggested by egreg
+
+
+
+2017-04-30, Uwe Ziegenhagen 
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/latex/varsfromjobname/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.tex	2017-05-02 21:11:59 UTC (rev 44153)
+++ trunk/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.tex	2017-05-02 21:41:13 UTC (rev 44154)
@@ -1,34 +1,152 @@
-\documentclass{article}
-
+\documentclass[12pt]{article}
+\usepackage{listings}
 \nofiles
 
 \usepackage{varsfromjobname}
+\usepackage[default]{sourcesanspro}
+\setlength{\parskip}{1em}
+\setlength{\parindent}{0em}
+\usepackage[left=3cm, right=3cm, top=3cm, bottom=3cm]{geometry}
 
-\date{January 11th 2009}
-\author{Uwe Ziegenhagen}
+
+\date{May 1st 2016}
+\author{Uwe Ziegenhagen, ziegenhagen at gmail.com}
 \title{\texttt{varsfromjobname} Description}
 
+
+
 \begin{document}
 \maketitle
 
-\noindent Using \texttt{varsfromjobname.sty} one can easily extract information from the filename, if it follows a certain form. The LaTeX command \verb|\|jobname returns the name of the LaTeX file. If the filename consists of tokens separated by hyphen we can easily extract certain tokens that can be used inside the document. The package expects the filename to be of the form 
+\noindent Using \texttt{varsfromjobname.sty} one can easily extract information from the filename, if it follows a certain form. The LaTeX command \verb|\|jobname returns the name of the LaTeX file. 
 
+If the filename consists of tokens separated by hyphen we can easily extract certain tokens that can be used inside the document. 
+
+The package expects the filename to be of the form 
+
 \noindent\texttt{one-two-three-four-five-six-seven-eight-nine.tex} 
 
 \noindent and offers the following commands:
 
 \begin{itemize}
-	\item \verb|\|getfromjobname\{\textit{param}\}, with \textit{param} in the range of 1 to 9 (highlevel interface to the following commands)
-	\item \verb|\|getonefromjobname
-	\item \verb|\|gettwofromjobname
-	\item \verb|\|getthreefromjobname
-	\item \verb|\|getfourfromjobname
-	\item \verb|\|getfivefromjobname
-	\item \verb|\|getsixfromjobname
-	\item \verb|\|getsevenfromjobname
-	\item \verb|\|geteightfromjobname
-	\item \verb|\|getninefromjobname	
+	\item \verb|\getfromjobname|\{\textit{param}\}, with \textit{param} in the
+	 range of 1 to 9 (highlevel interface to the following commands)
+	\item \verb|\getonefromjobname|
+	\item \verb|\gettwofromjobname|
+	\item \verb|\getthreefromjobname|
+	\item \verb|\getfourfromjobname|
+	\item \verb|\getfivefromjobname|
+	\item \verb|\getsixfromjobname|
+	\item \verb|\getsevenfromjobname|
+	\item \verb|\geteightfromjobname|
+	\item \verb|\getninefromjobname|	
 \end{itemize}
 
+For included documents the package uses the \texttt{currfile} package to provide the following commands: 
 
+\begin{itemize}
+	\item \verb|\getfromcurrfilename|\{\textit{param}\}, with \textit{param} in the
+	 range of 1 to 9 (highlevel interface to the following commands)
+	\item \verb|\getonefromcurrfilename|
+	\item \verb|\gettwofromcurrfilename|
+	\item \verb|\getthreefromcurrfilename|
+	\item \verb|\getfourfromcurrfilename|
+	\item \verb|\getfivefromcurrfilename|
+	\item \verb|\getsixfromcurrfilename|
+	\item \verb|\getsevenfromcurrfilename|
+	\item \verb|\geteightfromcurrfilename|
+	\item \verb|\getninefromcurrfilename|	
+\end{itemize}
+
+\section*{Example}
+
+Place the code from Listing 1 in a file \textbf{a-b-c-d-e-f-g-h-i-j.tex} and the code from
+ Listing~2 in a file named \textbf{z-y-x-w-v-u-t-s-r-q.tex}. Then compile the first file with pdflatex.
+
+\begin{lstlisting}[caption={\textbf{a-b-c-d-e-f-g-h-i-j.tex}}]
+% testfiles for varsfromjobname.sty
+\documentclass{article}
+\listfiles
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{varsfromjobname}
+\begin{document}
+
+a: \getonefromjobname % a
+
+b: \gettwofromjobname % b
+
+c: \getthreefromjobname % c
+
+d: \getfourfromjobname % d
+
+e: \getfivefromjobname % e
+
+f: \getsixfromjobname % f 
+
+g: \getsevenfromjobname % g
+
+h: \geteightfromjobname %h 
+
+i-j: \getninefromjobname % i-j
+
+a: \getfromjobname{1} % a
+
+b: \getfromjobname{2} % b 
+
+c: \getfromjobname{3} % c
+
+d: \getfromjobname{4} % d
+
+e: \getfromjobname{5} % e
+
+f: \getfromjobname{6} % f
+
+g: \getfromjobname{7} % g 
+
+h: \getfromjobname{8} % h
+
+i-j: \getfromjobname{9} % i-j
+
+\input{z-y-x-w-v-u-t-s-r-q}
+
 \end{document}
+\end{lstlisting}
+
+
+
+
+\begin{lstlisting}[caption={\textbf{z-y-x-w-v-u-t-s-r-q.tex}}]
+z: \getonefromcurrfilename
+
+y: \gettwofromcurrfilename
+
+x: \getthreefromcurrfilename
+
+w: \getfourfromcurrfilename
+
+v: \getfivefromcurrfilename
+
+u: \getsixfromcurrfilename
+
+t: \getsevenfromcurrfilename
+
+s: \geteightfromcurrfilename
+
+r-q: \getninefromcurrfilename
+\end{lstlisting}
+
+
+\section*{Change History}
+
+\begin{description}
+	\item [Version 0.5] as of January 11th 2009: Initial version published
+	\item [Version 1.0] published May 2017:
+        Added various commands which extract necessary information also from included documents
+        Modified code as suggested by egreg
+\end{description}
+
+    
+\vfill 2017-05-01, Uwe Ziegenhagen
+
+\end{document}

Modified: trunk/Master/texmf-dist/tex/latex/varsfromjobname/varsfromjobname.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/varsfromjobname/varsfromjobname.sty	2017-05-02 21:11:59 UTC (rev 44153)
+++ trunk/Master/texmf-dist/tex/latex/varsfromjobname/varsfromjobname.sty	2017-05-02 21:41:13 UTC (rev 44154)
@@ -1,7 +1,8 @@
 %begin of varsfromjobname.sty
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{varsfromjobname}[2009/01/11 v. 0.5 extracts tokens from jobname (UZ)]
-\RequirePackage{ifthen} 
+\ProvidesPackage{varsfromjobname}[2017/05/07 v. 1.0 extracts tokens from jobname]
+\RequirePackage{ifthen}
+\RequirePackage{currfile}
 
 % Author: Uwe Ziegenhagen
 % based on code supplied by Friedrich Vosberg and Markus Kohm
@@ -74,13 +75,11 @@
 #5%
 }
 
-
 \newcommand*\@getsixfromfilename{}
 \def\@getsixfromfilename#1-#2-#3-#4-#5-#6-#7-#8-#9\@nil{%
 #6%
 }
 
-
 \newcommand*\@getsevenfromfilename{}
 \def\@getsevenfromfilename#1-#2-#3-#4-#5-#6-#7-#8-#9\@nil{%
 #7%
@@ -96,17 +95,73 @@
 #9%
 }
 
+% as proposed by egreg, 
+% https://tex.stackexchange.com/questions/212169/qr-code-from-jobname
 \newcommand{\getfromjobname}[1]{%
-\ifthenelse{\equal{#1}{1}}{\getonefromjobname}{}%
-\ifthenelse{\equal{#1}{2}}{\gettwofromjobname}{}%
-\ifthenelse{\equal{#1}{3}}{\getthreefromjobname}{}%
-\ifthenelse{\equal{#1}{4}}{\getfourfromjobname}{}%
-\ifthenelse{\equal{#1}{5}}{\getfivefromjobname}{}%
-\ifthenelse{\equal{#1}{6}}{\getsixfromjobname}{}%
-\ifthenelse{\equal{#1}{7}}{\getsevenfromjobname}{}%
-\ifthenelse{\equal{#1}{8}}{\geteightfromjobname}{}%
-\ifthenelse{\equal{#1}{9}}{\getninefromjobname}{}%
+  \ifcase#1 \or%
+    \getonefromjobname\or%
+    \gettwofromjobname\or%
+    \getthreefromjobname\or%
+    \getfourfromjobname\or%
+    \getfivefromjobname\or%
+    \getsixfromjobname\or%
+    \getsevenfromjobname\or%
+    \geteightfromjobname\or%
+    \getninefromjobname%
+  \fi%
 }
 
+% for the currfilebase version
+
+\newcommand*{\getonefromcurrfilename}{%
+  \expandafter\@getonefromfilename\currfilebase--------\@nil%
+}
+
+\newcommand*{\gettwofromcurrfilename}{%
+  \expandafter\@gettwofromfilename\currfilebase--------\@nil%
+}
+
+\newcommand*{\getthreefromcurrfilename}{%
+  \expandafter\@getthreefromfilename\currfilebase--------\@nil%
+}
+
+\newcommand*{\getfourfromcurrfilename}{%
+  \expandafter\@getfourfromfilename\currfilebase--------\@nil%
+}
+
+\newcommand*{\getfivefromcurrfilename}{%
+  \expandafter\@getfivefromfilename\currfilebase--------\@nil%
+}
+
+\newcommand*{\getsixfromcurrfilename}{%
+  \expandafter\@getsixfromfilename\currfilebase--------\@nil%
+}
+
+\newcommand*{\getsevenfromcurrfilename}{%
+  \expandafter\@getsevenfromfilename\currfilebase--------\@nil%
+}
+
+\newcommand*{\geteightfromcurrfilename}{%
+  \expandafter\@geteightfromfilename\currfilebase--------\@nil%
+}
+
+\newcommand*{\getninefromcurrfilename}{%
+  \expandafter\@getninefromfilename\currfilebase\@nil%
+}
+
+\newcommand{\getfromcurrfilename}[1]{%
+  \ifcase#1 \or%
+    \getonefromcurrfilename\or%
+    \gettwofromcurrfilename\or%
+    \getthreefromcurrfilename\or%
+    \getfourfromcurrfilename\or%
+    \getfivefromcurrfilename\or%
+    \getsixfromcurrfilename\or%
+    \getsevenfromcurrfilename\or%
+    \geteightfromcurrfilename\or%
+    \getninefromcurrfilename%
+  \fi%
+}
+
 \makeatother
-% end of jobdate.sty
+% end of jobdate.sty
\ No newline at end of file



More information about the tex-live-commits mailing list