summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-05-02 21:41:13 +0000
committerKarl Berry <karl@freefriends.org>2017-05-02 21:41:13 +0000
commit6e4c9895b91d909b7d6f65553dbb41186f54b8da (patch)
treede50c0bacab3cd575964c0a4a4a847e4bd75a4f0
parent81f07c7a915e291b32a374633d29f64be74c1c88 (diff)
varsfromjobname (2may17)
git-svn-id: svn://tug.org/texlive/trunk@44154 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/varsfromjobname/README40
-rw-r--r--Master/texmf-dist/doc/latex/varsfromjobname/README.md65
-rw-r--r--Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.pdfbin36992 -> 183061 bytes
-rw-r--r--Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.tex148
-rw-r--r--Master/texmf-dist/tex/latex/varsfromjobname/varsfromjobname.sty83
5 files changed, 267 insertions, 69 deletions
diff --git a/Master/texmf-dist/doc/latex/varsfromjobname/README b/Master/texmf-dist/doc/latex/varsfromjobname/README
deleted file mode 100644
index 5352e8a6622..00000000000
--- a/Master/texmf-dist/doc/latex/varsfromjobname/README
+++ /dev/null
@@ -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
diff --git a/Master/texmf-dist/doc/latex/varsfromjobname/README.md b/Master/texmf-dist/doc/latex/varsfromjobname/README.md
new file mode 100644
index 00000000000..daddfd34161
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/varsfromjobname/README.md
@@ -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
diff --git a/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.pdf b/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.pdf
index ade1eee0bda..89240294a0a 100644
--- a/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.pdf
+++ b/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.tex b/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.tex
index f3a4028b63c..55516a138ad 100644
--- a/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.tex
+++ b/Master/texmf-dist/doc/latex/varsfromjobname/varsfromjobname.tex
@@ -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@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}
diff --git a/Master/texmf-dist/tex/latex/varsfromjobname/varsfromjobname.sty b/Master/texmf-dist/tex/latex/varsfromjobname/varsfromjobname.sty
index bb65d9ef998..57893a1f394 100644
--- a/Master/texmf-dist/tex/latex/varsfromjobname/varsfromjobname.sty
+++ b/Master/texmf-dist/tex/latex/varsfromjobname/varsfromjobname.sty
@@ -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