%\iffalse %<*package> %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} % %\fi % \iffalse % Doc-Source file % Copyright (C) 2016-2020 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> \documentclass{ltxdoc} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{etoolbox} \usepackage{textcomp} \usepackage{tgtermes} \usepackage{upquote} \usepackage{metalogo} \usepackage[colorlinks,hyperindex=false]{hyperref} \usepackage[abbreviations,nomain,nonumberlist,nogroupskip]{glossaries-extra} \makeglossaries \makeatletter% doc.sty interferes with upquote.sty \def\@verbatim{\trivlist \item[]\if@minipage\else\vskip\parskip\fi \leftskip\@totalleftmargin\rightskip\z@ \parindent\z@\parfillskip\@flushglue\parskip\z@ \@@par \@tempswafalse \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par \penalty\interlinepenalty \check@percent}% \obeylines \@noligs \let\do\@makeother \dospecials} \renewcommand{\meta@font@select}{\rmfamily\itshape} \makeatother \CheckSum{3472} \RecordChanges \PageIndex \CodelineNumbered \IndexPrologue{\clearpage\phantomsection\section*{Index}\markboth{Index}{Index}% \addcontentsline{toc}{section}{Index}} \setcounter{IndexColumns}{2} \renewcommand*{\usage}[1]{\hyperpage{#1}} \renewcommand*{\main}[1]{\hyperpage{#1}} \newcommand*{\ics}[1]{\cs{#1}\SpecialMainIndex{#1}} \newcommand*{\qt}[1]{``#1''} \newcommand*{\sty}[1]{\textsf{#1}} \newcommand*{\app}[1]{\texttt{#1}} \newcommand*{\file}[1]{\texttt{#1}} \providecommand*{\eTeX}{e\TeX} \newcommand*{\shortargfmt}[1]{\texttt{-#1}} \newcommand*{\longargfmt}[1]{\texttt{-{}-#1}} \newcommand*{\shortarg}[1]{\shortargfmt{#1}% \index{texosquery options=\app{texosquery} options>#1=\protect\shortargfmt{-#1}|hyperpage}} \newcommand*{\longarg}[1]{\longargfmt{#1}% \index{texosquery options=\app{texosquery} options>#1=\protect\longargfmt{#1}|hyperpage}} \newcommand*{\Index}[1]{#1\index{#1|hyperpage}} \newenvironment{important} {\begin{quote}\textbf{Important Note:}} {\end{quote}} \newenvironment{definition} {\begin{flushleft}\ttfamily} {\end{flushleft}} \setcounter{secnumdepth}{2} \pdfstringdefDisableCommands{\renewcommand\meta[1]{#1}} \glssetcategoryattribute{abbreviation}{nohyperfirst}{true} \setabbreviationstyle[noexpand]{short} \newabbreviation[category=noexpand]{IETF}{IETF}{Internet Engineering Task Force} \newabbreviation[category=noexpand]{BCP}{BCP}{Best Common Practice} \newabbreviation[category=noexpand]{POSIX}{POSIX}{Portable Operating System Interface} \newabbreviation[category=noexpand]{CTAN}{CTAN}{Comprehensive \TeX\ Archive Network} \newabbreviation[category=noexpand]{UTF}{UTF}{Unicode Transformation Format} \newabbreviation[category=noexpand]{ASCII}{ASCII}{American Standard Code for Information Interchange} \newabbreviation[category=noexpand]{ISO}{ISO}{International Organization for Standardization} \newabbreviation{OS}{OS}{operating system} \newabbreviation{JRE}{JRE}{Java Runtime Environment} \newabbreviation{CLDR}{CLDR}{Unicode Consortium's Common Locale Data Repository} \begin{document} \DocInput{texosquery.dtx} \end{document} % %\fi % %\DeleteShortVerb{|} % %\title{texosquery: query OS information from \TeX} %\author{Nicola L. C. Talbot\\ %\href{http://www.dickimaw-books.com/}{\nolinkurl{dickimaw-books.com}} %\and Paulo Cereda} %\date{2020-02-04 (v1.7)} %\maketitle % %\begin{abstract} %The \sty{texosquery} bundle provides the \app{texosquery.jar} application (and %variations \app{texosquery-jre8.jar} and \app{texosquery-jre5.jar}) %This is a cross-platform Java application to query certain %\gls{OS} and locale information. The application is %specifically designed for use within \TeX's shell escape mechanism, %through the \cs{TeXOSQuery} command provided by the \sty{texosquery} package %(\file{texosquery.tex} and \file{texosquery.sty}). % %The \cs{TeXOSQuery} command performs more than a simple piped input as it %first changes category codes of various problematic characters and locally %defines some short control sequences that are used in the application's result. %These commands aren't defined outside of \cs{TeXOSQuery}, so a %direct piped input may cause undefined control sequences. If you %really want to use this direct method rather than using %\cs{TeXOSQuery}, then you will need to run \app{texosquery} in %backward compatibility mode~0 or~1 (using \texttt{\longarg{compatible} 1}). %The first two versions of \app{texosquery} didn't use those short %commands. %\end{abstract} % %\begin{important} %You will need \TeX's piped shell escape enabled %and you will also need the \gls{JRE} installed. %MiKTeX users will need to add \verb|--enable-pipes| to TeX's %command line options. (Alternatively, use \cs{TeXOSQueryFromFile} %if you can't use the piped shell escape.) %The configuration file \hyperref[itm:cfg]{\file{texosquery.cfg}} %should be edited to reflect your system set-up before use. %\end{important} % %There are three variations of the \app{texosquery} application provided: %\begin{itemize} %\item \file{texosquery.jar}: requires at least Java~7, has medium locale %support, obeys \texttt{openin\_any} but has additional %restrictions imposed for security reasons (no listings outside the %current working directory path); Note that Java 7 has reached its %\href{http://www.oracle.com/technetwork/java/eol-135779.html}{end %of life and is now deprecated}. %\item \file{texosquery-jre8.jar}: requires at least Java~8, has best locale %support, is on \TeX\ Live's restricted list, obeys \texttt{openin\_any} but has additional %restrictions imposed for security reasons (no listings outside the %current working directory path); %\item \file{texosquery-jre5.jar}: requires at least Java~5, has poor locale %support (language scripts not recognised), doesn't have the walk %action, obeys \texttt{openin\_any} but doesn't have the extra restrictions of the %Java 7 and 8 versions for the listing functions. Note that Java~5 and~6 %are deprecated. Old deprecated versions are considered a security %risk. %\end{itemize} %The default is now \file{texosquery-jre8.jar}. If you have an older %version of Java you will need to edit the \file{texosquery.cfg} %file (although, if possible, you should consider upgrading your Java version for %security reasons). Throughout this document %\app{texosquery} is used to reference the application, regardless %which of these three jar files you've chosen to use. See %section~\ref{sec:setup} for further details. % %The aim of the original version of \app{texosquery} was to provide %a way of accessing the operating system's locale information. %Version 1.3 of the \sty{tracklang} package provides %\cs{TrackLangQueryEnv} which uses \app{kpsewhich} to query the %appropriate locale environment variable (such as \verb|$LANG| %or \verb|LC_ALL|). Unfortunately this doesn't work under Windows as %the locale information there is stored in the registry. The Lua %\texttt{os.setlocale(nil)} function can simply return \texttt{C} or %\texttt{POSIX}, which isn't helpful from \sty{tracklang}'s point of %view. Although Java has its drawbacks, it's one of the most %ubiquitous platform-independent methods to obtain this information. %Since it seemed overkill to write a Java application that simply %returned the locale, I decided to add a few extra functions that %might be of use, but accessing locale information was, and still %is, the primary purpose of this application. % %Although the \gls{POSIX} environment variables, such as %\verb|$LC_ALL|, are easy to read with \app{kpsewhich}, these days %the \gls{IETF} \gls{BCP}~47 language tag is the more appropriate way %of identifying a locale, so version 1.2 has added the \longarg{bcp47} %function to support this. The \sty{tracklang} package has similarly added %\cs{TrackLanguageTag}\marg{IETF tag}. % %The \longarg{numeric}, \longarg{locale-data}, \longarg{date-time} and %\longarg{time-zones} options are designed to %interface with the \sty{tex-locale} package, so although %\sty{texosquery} and \sty{tex-locale} are distributed separately, %version 1.2 of \app{texosquery} was %developed alongside version 1.0 of the \sty{tex-locale} package. %The aim of the \sty{tex-locale} package is to use both \sty{tracklang} %and \sty{texosquery} to automatically set up the document language. %For example, in the following \LaTeX\ document %\begin{verbatim} %\documentclass{article} %\usepackage{tex-locale} %\begin{document} %Language: \CurrentLocaleLanguageNativeName. %Region: \CurrentLocaleRegionNativeName. %Today: \CurrentLocaleDate. (Compare with \today.) %Time: \CurrentLocaleTime. %Currency Symbol: \CurrentLocaleCurrency %Integer: %\texosqueryfmtnumber{\CurrentLocaleIntegerPattern}{123456}{0}{0} %Decimal: %\texosqueryfmtnumber{\CurrentLocaleDecimalPattern}{123456}{78}{0} %Percentage: %\texosqueryfmtnumber{\CurrentLocalePercentPattern}{0}{65}{0} %Currency: %\texosqueryfmtnumber{\CurrentLocaleCurrencyPattern}{1234567}{0}{0} %\end{document} %\end{verbatim} %the \sty{tex-locale} package will automatically: %\begin{itemize} %\item load the \sty{textcomp} package for currency symbols (package %option \texttt{symbols=fontawesome} will use \sty{fontawesome} %instead); %\item if \XeLaTeX\ or \LuaLaTeX: % \begin{itemize} % \item load \sty{fontspec} (unless option \texttt{fontspec=false} % is used); % \item load \sty{polyglossia} and use \cs{setmainlanguage} % with options that can be determined from the language tag % (use package option \texttt{support=babel} to use \sty{babel} % regardless of the \LaTeX\ format); % \end{itemize} % otherwise: % \begin{itemize} % \item load \sty{inputenc} (default file encoding obtained from % \app{texosquery}'s \longarg{codeset-lcs} action); % \item load \sty{fontenc} (font encoding obtained using % \sty{tracklang} to query the language script); % \item load \sty{babel} with the appropriate language label (use % \texttt{support=none} to prevent this); % \end{itemize} %\item load \sty{datetime2} with the \texttt{useregional=text} %option (use \texttt{datetime2=false} to prevent this). %\end{itemize} % %The generic \texttt{locale.tex} code doesn't load the above packages, but can %still obtain information about the locale: %\begin{verbatim} %\input locale %Language: \CurrentLocaleLanguageNativeName. %Region: \CurrentLocaleRegionNativeName. %Today: \CurrentLocaleDate. (Compare with \today.) %Time: \CurrentLocaleTime. %Currency Symbol: \CurrentLocaleCurrency %Integer: %\texosqueryfmtnumber{\CurrentLocaleIntegerPattern}{123456}{0}{0} %Decimal: %\texosqueryfmtnumber{\CurrentLocaleDecimalPattern}{123456}{78}{0} %Percentage: %\texosqueryfmtnumber{\CurrentLocalePercentPattern}{0}{65}{0} %Currency: %\texosqueryfmtnumber{\CurrentLocaleCurrencyPattern}{1234567}{0}{0} %\bye %\end{verbatim} % %So that's the reasoning behind the new v1.2 actions. % %\clearpage %\tableofcontents %\clearpage % %\section{texosquery.jar: the Java application} %The \app{texosquery} Java command line application looks up %certain system information that may be of use in \TeX\ %documents. This information can be obtained using %native commands, but the Java application allows an %\gls{OS}-independent approach with results that can easily be %captured by \TeX's shell-escape without having to strip %formatting information. It also uses control sequence markup to indicate %whether characters should be interpreted literally (such as in file names) or %if they should obey their current category code (such as %punctuation occurring in textual information) or if they should be %interpreted in some other way (such as pattern markup). This markup %is expanded by \cs{TeXOSQuery} when it performs the piped shell %escape. % %\begin{important} %\app{texosquery} provides read-only actions, and I don't %intend adding any actions that modify system settings or files. %\end{important} % %Since the application is designed to work with \TeX\ (through %\cs{TeXOSQuery} defined in \file{texosquery.tex}) each action (indicated %by a command line switch) will display the result on a single line. %For multiple results, each line is grouped. A blank line (or empty group) %will be displayed if the information isn't available or is prohibited. %A forward slash (\cs{fslh}) is always used as a directory divider, %regardless of the operating system, so the result can be used, for example, %in \cs{input} or \cs{includegraphics}. % %For example, I have a 64-bit Linux operating system installed on my %computer, so I could use \app{uname} in a bash terminal: %\begin{verbatim} %uname -o -r %\end{verbatim} %which (for me) produces: %\begin{verbatim} %4.1.13-100.fc21.x86_64 GNU/Linux %\end{verbatim} %I could also run \app{texosquery} directly from the bash terminal: %\begin{verbatim} %texosquery -o -r %\end{verbatim} %which produces the rather more cryptic: %\begin{verbatim} %{Linux} %{4\fdot 1\fdot 13\fhyn 100\fdot fc21\fdot x86\fusc 64} %\end{verbatim} %However \app{texosquery} isn't intended for this direct use. It's %intended for use with \cs{TeXOSQuery} provided by %\file{texosquery.tex}. Here's a plain \TeX\ document: %\begin{verbatim} %\input texosquery %\TeXOSQuery{\result}{-o -r} %\def\parseresult#1#2{OS Name: {\tt #1}. OS Version: {\tt #2}.} %\ifx\result\empty % Query failed! %\else % \expandafter\parseresult\result %\fi %\bye %\end{verbatim} %The markup commands, such as \cs{fusc}, are now converted to %literal characters with category code 12 (\qt{other}), so the %underscore isn't a problem. This document is now also platform independent %(as long as \app{texosquery} and a recent version of the \gls{JRE} are %installed). Unlike \app{uname}, \app{texosquery} also obeys the order of the %command line switches, which makes it easier to define the helper %command (\cs{parseresult} in the above) that processes the result. % %\subsection{Installation and Setup} %\label{sec:setup} % %Installation is best done through your \TeX\ package manager. %However if for some reason you need to install this package %manually the instructions are below. If you install through your %package manager, Windows users will probably find that the %\file{.jar} files have been converted to \file{.exe} (with the %\file{.bat} files omitted) and Unix-like users may find that the %bash scripts are missing the \file{.sh} extension (these are actually %symbolic links to the distributed \file{.sh} files). See %section~\ref{sec:setuptest} to test that the package has been %successfully installed. % %Even if you use your \TeX\ distribution's package manager to %install this package, you may still need to edit the %\file{texosquery.cfg} file (see step~\ref{itm:cfg} below). It's %best to copy this file to your \meta{TEXMFHOME} or \meta{TEXMFLOCAL} %tree to avoid losing your changes when the package is updated. %You can find the correct value of \meta{TEXMFHOME} using %\begin{verbatim} %kpsewhich -var-value=TEXMFHOME %\end{verbatim} %Similarly for \meta{TEXMFLOCAL}. % %You can find where the package manager has put \file{texosquery.cfg} using %\begin{verbatim} %kpsewhich texosquery.cfg %\end{verbatim} % %This bundle contains the following files: %\begin{itemize} %\item \file{texosquery.dtx} % %The DTX file contains the source code for this %document, and also the files: %\begin{itemize} %\item\file{texosquery.tex} (generic \TeX\ code) %\item\file{texosquery.sty} (\LaTeX\ package wrapper) %\item\file{texosquery.cfg} (configuration file) %\end{itemize} %The bash scripts (which will need the extensions removed): %\begin{itemize} %\item\file{texosquery-jre8.sh} %\item\file{texosquery.sh} %\item\file{texosquery-jre5.sh} %\end{itemize} %Windows batch files (which will need the extensions changed to %\file{.bat}) %\begin{itemize} %\item\file{texosquery-jre8.batch} %\item\file{texosquery.batch} %\item\file{texosquery-jre5.batch} %\end{itemize} % %\item \file{texosquery.ins} The driver file used to extract all the %above files contained in \file{texosquery.dtx}. % %\item The three different versions of the \app{texosquery} %application: \file{texosquery-jre8.jar}, \file{texosquery.jar} and %\file{texosquery-jre5.jar}. The source code for these is contained in %the \file{java} sub-directory. % %\item \file{texosquery.pdf} This PDF document. %\item \file{README.md} The README file in markdown format. %\item \file{CHANGES} Lists major changes for each version. %\end{itemize} % %To install manually (\meta{TEXMF} indicates the TEXMF directory): %\begin{enumerate} %\item Run %\begin{verbatim} %tex texosquery.ins %\end{verbatim} %to extract the \file{.tex}, \file{.sty}, \file{.cfg}, \file{.sh} %and \file{.batch} files. % %\begin{description} %\item[Windows] Change the extension of the \file{.batch} files to %\file{.bat} (\TeX\ on Windows prohibits the creation of \file{.bat} %files). Move the \file{.bat} files to somewhere on %your system's path. (You may omit the \file{.bat} files you don't %need.) The \file{.sh} files may be deleted. % %\item[Unix-like] Make the \file{.sh} files executable: %\begin{verbatim} %chmod u+x texosquery*.sh %\end{verbatim} %Move the \file{.sh} files to somewhere on your path \emph{without} the %\file{.sh} extension. (If the \file{.sh} extension is retained, you %will have to edit the \file{texosquery.cfg} file to include it.) %For example (if \verb|~/bin| is included in \verb|$PATH|): %\begin{verbatim} %mv texosquery-jre8.sh ~/bin/texosquery-jre8 %\end{verbatim} %(You may omit the \file{.sh} files you don't need.) %The \file{.batch} files may be deleted. %\end{description} % %\item Move \file{texosquery.tex} to %\meta{TEXMF}\file{/tex/generic/texosquery/} % %\item\label{itm:cfg} Edit \file{texosquery.cfg} so that \cs{TeXOSInvokerName} is %defined to the application of your choice. For example, if you have %Java 8 installed: %\begin{verbatim} %\def\TeXOSInvokerName{texosquery-jre8} %\end{verbatim} %Or if you only have Java 5 or 6 installed: %\begin{verbatim} %\def\TeXOSInvokerName{texosquery-jre5} %\end{verbatim} %You can find out your Java version by running the following in your %command prompt or terminal: %\begin{verbatim} %java -version %\end{verbatim} %If the version number starts with \texttt{1.8} then you have Java 8 %installed, if it starts with \texttt{1.7} then you have Java 7, %etc. % %\item Move \file{texosquery.cfg} to %\meta{TEXMF}\file{/tex/generic/texosquery/} %\item Move \file{texosquery.sty} to %\meta{TEXMF}\file{/tex/latex/texosquery/} %\item Move the \file{.jar} files to %\meta{TEXMF}\file{/scripts/texosquery/} %\end{enumerate} % %\subsection{Installation Test} %\label{sec:setuptest} % %To test the installation: %\begin{enumerate} %\item In the %\href{http://www.dickimaw-books.com/latex/novices/html/terminal.html}{command %prompt or terminal} do: %\begin{verbatim} %texosquery -b %\end{verbatim} %(Replace \texttt{texosquery} with the command that matches the value %of \cs{TeXOSInvokerName} in the \hyperref[itm:cfg]{\file{texosquery.cfg} file} %described in section~\ref{sec:setup}.) %The above command should display the system's %default locale. For me, this simply displays the line: %\begin{verbatim} %en-GB %\end{verbatim} %If you get an \texttt{Unknown option %\textquotesingle-b\textquotesingle} error, then your \gls{OS} is %picking up an old version of \app{texosquery}. Check the version %number with the \shortarg{v} switch. %\begin{verbatim} %texosquery -v %\end{verbatim} %If you get a \qt{command not found} or \qt{bad command or file name} error, %then recheck the installation steps in section~\ref{sec:setup} and %make sure that the executable file has been placed on your system's %path. % %If this test is successful, try the next step. %\item Create the following plain \TeX\ document called \file{test.tex}: %\begin{verbatim} %\input texosquery %\TeXOSQuery{\result}{-b}\result %\bye %\end{verbatim} %and compile using: %\begin{verbatim} %pdftex --shell-escape test %\end{verbatim} % %Alternatively, create the follow \LaTeX\ document called %\file{test.tex}: %\begin{verbatim} %\documentclass{article} %\usepackage{texosquery} %\begin{document} %\TeXOSQuery{\result}{-b}\result %\end{document} %\end{verbatim} %and compile using: %\begin{verbatim} %pdflatex --shell-escape test %\end{verbatim} % %In both cases, the resulting PDF file \file{test.pdf} should show the default %locale. If not check the transcript \file{test.log} which should %include something like \verb"(|texosquery -b)" or \verb"(|texosquery-jre8 -b)" %etc. If it simply has the line: %\begin{verbatim} %TeXOSQuery: texosquery -b %\end{verbatim} %(or similar) then the dry run mode was on, which means the shell escape wasn't %used. Check that the \longarg{shell-escape} switch was used when %calling \app{pdftex} or \app{pdflatex}. % %\TeX\ Live 2017 has added \app{texosquery-jre8} to the restricted %list, but you need to modify the configuration file to take %advantage of this. Make sure %that the line %\begin{verbatim} %\TeXOSQueryAllowRestricted %\end{verbatim} %hasn't been commented out in the \file{texosquery.cfg} file and try %the above example documents in restricted mode. %\end{enumerate} % %\subsection{Accessing file information} %\label{sec:fileaccess} %If an input file name is required (for example, with the %\longargfmt{pdfdate} argument described below) then the file may be in %the current working directory, relative to the current directory %(with forward slash \texttt{/} as the directory divider), an absolute path %(again with forward slash) or on \TeX's path (in %which case, \app{kpsewhich} is used to locate it). As from version %1.2, \app{texosquery} honours the \texttt{openin\_any} attribute set in the %\file{texmf.cnf} configuration file. This value is fetched using %\begin{verbatim} %kpsewhich -var-value=openin_any %\end{verbatim} %(You can find the configuration files using \texttt{kpsewhich -a %texmf.cnf}) For example, suppose the file \file{/tmp/.test} %exists. If the \texttt{openin\_any} attribute is set to \qt{\texttt{a}} %(any file), then (assuming the operating system allows read-access %to that file) the \app{texosquery} file-reading operations will %be permitted. For example %\begin{verbatim} %texosquery --pdfdate /tmp/.test %\end{verbatim} %will return the file modification date in PDF date-time format. However, if %\texttt{openin\_any} is set to \qt{\texttt{r}} (restricted), the read %access will be denied because the file is considered hidden so an %empty result is returned. Similarly, if \texttt{openin\_any} is set %to \qt{\texttt{p}} (paranoid), the read access will be denied again %because the file is hidden but also because the file has an %absolute path that isn't under \texttt{\$TEXMFOUTPUT} (assuming %that environment variable hasn't been set to \file{/tmp}). % %\subsection{MiKTeX}\label{sec:miktex} %MiKTeX doesn't support the \texttt{openin\_any} %variable so, if this is unset, \file{texosquery} will fallback on %\qt{\texttt{a}}. % %Note that MiKTeX disables piped input by default for security %reasons. Since \cs{TeXOSQuery} relies on piped input, you'll need %to enable it with \texttt{-{}-enable-pipes} when you run \TeX. % %\subsection{Restricted Mode}\label{sec:restricted} %TeX Live 2017 now has \app{texosquery-jre8} on the list of trusted %applications that may be run in restricted mode. In order to make %use of this, you need to set up your %\hyperref[itm:cfg]{configuration file} to use both %\app{texosquery-jre8} and to automatically switch off the dry run %mode if the restricted shell escape is detected. However, note that %the restricted mode has limitations on the characters allowed in %the shell escape for security reasons. This means that arguments %(such as file names) can't be quoted in restricted mode and %therefore arguments that contain spaces can't be delimited and will %cause problems. Either avoid spaces in file names or use the %unrestricted mode. % %\subsection{Return Values} %\label{sec:returnvalues} %The return values may include literal text where special characters %need to have their category code changed to 12 (for example, file names) %but the return values may also include \TeX\ code that needs to be %processed by \TeX, either during the shell escape or deferred for %later (such as date-time or numeric patterns). This means that the %result from the shell escape can't be automatically detokenized. % %Therefore, as from version 1.2, the return values include short %control sequences that are locally defined by \cs{TeXOSQuery} and %so are only valid within that command's scope. For example, %\cs{fcln} expands to a colon (\texttt{:}) with category code 12 %whereas \cs{tcln} expands to a colon according to its current %meaning. Note that this has changed from earlier versions which %simply returned the actual characters, which may or may not have %had the category code set to 12 at the start of \cs{TeXOSQuery}. To %reproduce the original behaviour, use the compatibility mode %(\longarg{compatible}) with the level set to 0 or 1. %For the full list of shortcut commands, see the %definition of \hyperlink{enableshortcs}{\cs{@texosquery@enableshortcs}}. % %If the operating system uses a backslash \verb|\| as a directory %divider, returned path names will always replace this with a %forward slash \verb|/| (which is then converted to \cs{fslh}, as %described above). This is designed to make the result as compatible %as possible with \TeX\ file commands (such as \cs{input}) which %require a forward slash. However, for some systems, %further modification may need to be done. For example, with \TeX\ %on \Index{Cygwin}, the Windows path name %\verb|c:\cygwin64\usr\local\texlive| may correspond to the \TeX\ path %name \file{/usr/local/texlive}. This path is returned by %\app{texosquery} as \file{c:/cygwin64/usr/local/texlive} (\cs{fcln} and %\cs{fslh} replaced for clarity). You can use %\longargfmt{strip-path-prefix} to strip the leading %\file{c:/cygwin64} for convenience (see section~\ref{sec:invocation}). % %The output produced by the \app{texosquery} application %will be returned using the system's default file %encoding. (For example, \gls{UTF}-8.) You will need to ensure that your \TeX\ %document uses the same encoding if you want to typeset any of the %results that may contain non-ASCII characters. You can determine %the default encoding with \texttt{texosquery \shortarg{C}}, which is %formatted to match the options used by the \sty{inputenc} package. %(For example, \texttt{uft8} for \gls*{UTF}-8.) % %To test the file encoding rerun the plain \TeX\ or \LaTeX\ test %file in section~\ref{sec:setuptest} with %\shortarg{N} instead of \shortarg{b}. Most currency symbols are %outside the ASCII set, so this should return a non-ASCII character. %If you happen to have \$ as your currency, %then try \texttt{en-GB} or \texttt{en-IE} which have \pounds\ and %\texteuro, respectively. \LaTeX\ users may need to load %\sty{inputenc} and \sty{fontenc}. \XeLaTeX\ and \LuaLaTeX\ users may need to load %\sty{fontspec}. % %As from version 1.6, you can now override the default encoding %using the \longarg{encoding} option. This can be set on a document basis, %for example: %\begin{verbatim} %\usepackage[utf8]{inputenc} %\TeXOSQuery{\result}{--encoding UTF-8 -N} %\end{verbatim} %or for all documents by editing the \file{texosquery.cfg} file to %include the option in the invoker command. % %\subsection{Locales} %\label{sec:locales} %The options that have a locale identifier as an argument need the %identifier formatted as a \emph{regular} %\href{https://tools.ietf.org/html/bcp47}{IETF BCP 47 language tag} that uses %hyphens as separators. \gls{POSIX} style locales (with underscores %replaced by hyphens, for example \texttt{fr-BE.utf8@euro}) %are only used as a return value in the \longarg{locale} and %\longarg{locale-lcs} options. % %\href{http://www.oracle.com/technetwork/java/javase/java8locales-2095355.html}{\textbf{Not %all locales are supported by Java.}} %For example, Irish is supported but Scottish and Welsh aren't supported by %the \gls{JRE}. The \gls{CLDR} can be accessed with Java~8, but %\href{http://openjdk.java.net/jeps/252}{the CLDR isn't %enabled by default}. It can be turned on using the system property %\texttt{java.locale.providers}, which may provide additional %support. For example, although Welsh isn't supported by the JRE, %it is supported with the \gls{CLDR}, so both Java~8 and the CLDR %locale provider are required for that language. The proposed %Java~9 should have the CLDR enabled by default. % %The bash script \file{texosquery-jre8} %automatically sets \texttt{java.locale.providers} to \texttt{CLDR,JRE}. %Alternatively, the \texttt{JAVA\_TOOL\_OPTIONS} environment variable %can be set to %\begin{verbatim} %-Djava.locale.providers=CLDR,JRE %\end{verbatim} %which will enable it for all installed Java applications. %If you need to set multiple options, these can be combined %in the value of \texttt{JAVA\_TOOL\_OPTIONS}. %For example %\begin{verbatim} %-Djava.locale.providers=CLDR,JRE -Dfile.encoding=UTF-8 %\end{verbatim} % %You may find that the results are different depending on the data %provider. For example with \texttt{java.locale.providers} set to %\texttt{JRE,CLDR} then %\begin{verbatim} %texosquery -D en-GB %\end{verbatim} %displays the long date in the form \qt{06 November 2016} and the %medium date in the form \qt{06-Nov-2016}, but with the ordering %reversed to \texttt{CLDR,JRE} (so that the \gls{CLDR} is queried first) %then the long date is now in the form \qt{6 November 2016} and the %medium date is in the form \qt{6 Nov 2016}. % %Note that \app{texosquery} can only access locale information %provided by Java. For example, Java currently doesn't %provide any methods to access telephone codes. % %\subsection{Command line invocation}\label{sec:invocation} %The syntax for the command line invocation of \app{texosquery} %is: %\begin{definition} %texosquery \oarg{options} \meta{action} ... %\end{definition} %The syntax for \app{texosquery-jre8} is exactly the same except %for the application name: %\begin{definition} %texosquery-jre8 \oarg{options} \meta{action} ... %\end{definition} %Similarly for \app{texosquery-jre5}. (Bash users may need the %\file{.sh} extension if it wasn't removed from the script name %during the \hyperref[sec:setup]{installation setup}, but it's best %to remove it.) Available actions are %described below. At least one action is required. % %Available options (must come before actions): %\begin{description} %\item[\shortarg{h} or \longarg{help} or \shortarg{help}] Displays help message and %exits. % %\item[\shortarg{v} or \longarg{version} or \shortarg{version}] Displays version %information and exits. % %\item[\longarg{nodebug}] No debugging information. Only command %line syntax errors are written to STDERR. (Default.) % %\item[\longarg{debug} \oarg{n} or \shortarg{debug} \oarg{n}] Set the debugging level, where %\meta{n} is a non-negative integer. %If \meta{n} is omitted, 3 is assumed. If \meta{n} is 0, then %debugging information is suppressed (equivalent to %\longarg{nodebug}). If \meta{n} $\geq 1$, error messages are %written to STDERR. If \meta{n} $\geq 2$, any exceptions encountered %will additionally write the stack trace to STDERR. If \meta{n} %$\geq 3$ non-error informational messages are included. % %\item[\longarg{compatible} \meta{n} or \shortarg{compat} \meta{n}] %Set the compatibility mode. %The argument should be either a non-negative integer (0 for version %1.0, 1 for version 1.1, 2 for version 1.2 onwards) or the keyword \texttt{latest} to %indicate the latest version (default). Note that the compatibility %mode only affects the available actions and the display style of the %result, and does not change security features. For example, the check for the %\texttt{openin\_any} setting was only introduced to version 1.2, but this %is still checked even if the compatibility mode is set to 0 or 1. % %\item[\longarg{encoding} \meta{charset} or \shortarg{enc} %\meta{charset}] %(New to version 1.6.) This option may be used to override the %default file encoding. For example, if your native file encoding is %CP1250, but your document uses UTF-8 then you'll need to use %\longarg{encoding}\texttt{ UTF-8}. % %\item[\longarg{default-encoding} or \shortarg{defenc}] %(New to version 1.6.) This option is the default, but may %be used to cancel the effect of \longarg{encoding}. (For example, if %you have added \longarg{encoding} to the invoker command in the %\file{texosquery.cfg} file, but you want to cancel it in a %particular document.) %\end{description} % %The following options (introduced in v1.5) allow returned paths or URIs %to be altered (for example, if a mount point needs to be removed). %Note that these options only affect \emph{returned} paths, not %path names provided in the command line. The substitution is %performed after any backslash directory dividers %\verb|\| are changed to forward slashes \texttt{/} (if applicable) but before %non-alphanumerics are changed to control sequences (such as %\cs{fcln} or \cs{fslh}). If there's no match, the path is returned %without alteration. % %\begin{description} %\item[\longarg{strip-path-prefix} \meta{prefix} or \shortarg{sp} %\meta{prefix}] %Strip \meta{prefix} from the start of returned path names (but %not URIs, see below). For example: %\begin{verbatim} %texosquery --strip-path-prefix c:/cygwin64 -p article.cls %\end{verbatim} %This will strip the \texttt{c:/cygwin64} mount point. Note that %\meta{prefix} isn't an expression. For a regular expression, use %\longarg{replace-path}. (This option can't be %used with \longarg{replace-path}.) % %\item[\longarg{nostrip-path-prefix}] %Cancels the effect of \longarg{strip-path-prefix}. % %\item[\longarg{replace-path} \meta{regex} \meta{replacement} %or \shortarg{rp} \meta{regex} \meta{replacement}] %This replaces the \emph{first} occurrence of the regular %expression \meta{regex} in any returned path (but not URI) and replaces it with %\meta{replacement}. % %\item[\longarg{noreplace-path}] %Cancels the effect of the \longarg{replace-path}. % %\item[\longarg{strip-uri-prefix} \meta{prefix} or \shortarg{su} %\meta{prefix}] %Replace initial \texttt{file:/}\meta{prefix} with just %\texttt{file:/} from returned URIs. Note that %\meta{prefix} isn't an expression. For a regular expression, use %\longarg{replace-uri}. (This option can't be %used with \longarg{replace-uri}.) % %\item[\longarg{nostrip-uri-prefix}] %Cancels the effect of \longarg{strip-uri-prefix}. % %\item[\longarg{replace-uri} \meta{regex} \meta{replacement} %or \shortarg{ru} \meta{regex} \meta{replacement}] %This replaces the \emph{first} occurrence of the regular %expression \meta{regex} in any returned URI and replaces it with %\meta{replacement}. For example: %\begin{verbatim} %texosquery -ru file:/C: file://cgwin64/c -u filename %\end{verbatim} % %\item[\longarg{noreplace-uri}] %Cancels the effect of the \longarg{replace-uri}. %\end{description} % %If multiple actions are given, they will be processed in the %order specified in the command line invocation. Each result will %be displayed on a separate line. As from v1.1, if there are %multiple actions, each result will be grouped. This makes it easier %to process the results in \TeX. For example: %\begin{verbatim} %texosquery -l %\end{verbatim} %This just produces (for me): %\begin{verbatim} %en\fhyn GB\fdot utf8 %\end{verbatim} %(which expands to \texttt{en-GB.utf8} when used with \cs{TeXOSQuery}) whereas %\begin{verbatim} %texosquery -l -o %\end{verbatim} %produces: %\begin{verbatim} %{en\fhyn GB\fdot utf8} %{Linux} %\end{verbatim} %To reproduce the v1.0 display use \longarg{compatible}\texttt{ 0}. %(This will also explicitly use the punctuation characters rather %than replacing them with the control sequence markup, such as %\cs{fhyn} or \cs{fdot}.) % %Note that unavailable information will produce an empty group. %For example (assuming \file{nofile} doesn't exist or doesn't have %read access): %\begin{verbatim} %texosquery -l -d nofile %\end{verbatim} %produces: %\begin{verbatim} %{en\fhyn GB\fdot utf8} %{} %\end{verbatim} %whereas %\begin{verbatim} %texosquery -d nofile %\end{verbatim} %just displays an empty line. % %If you're puzzled as to why an empty line has been returned, try %rerunning the command with \longarg{debug} for further information. %Available actions are listed below. % %\subsubsection{Action \shortarg{b} or \longarg{bcp47}} %(New to version 1.2.) This action displays the \gls{BCP}~47 language tag. %For example, my locale is \texttt{en-GB} (English in the United %Kingdom), so %\begin{verbatim} %texosquery -b %\end{verbatim} %Simply returns: %\begin{verbatim} %en\fhyn GB %\end{verbatim} %(which expands to \texttt{en-GB} with \cs{TeXOSQuery}) %whereas a user whose default locale is set to Swiss German with the %new orthography would get: %\begin{verbatim} %de\fhyn CH\fhyn 1996 %\end{verbatim} %(which expands to \texttt{de-CH-1996} with \cs{TeXOSQuery}). % %\subsubsection{Action \shortarg{L} or \longarg{locale}} % %This action displays the locale information in the \gls{POSIX} form %\begin{definition} %\meta{lang}-\meta{region}.\meta{codeset}@\meta{modifier} %\end{definition} %where \meta{lang} is the \gls{ISO} code for the language (e.g.\ %\texttt{en}), %\meta{region} is the ISO code for the region (e.g.\ \texttt{GB}), %\meta{codeset} is the default code set (e.g.\ \texttt{UTF-8}) % and \meta{modifier} is the modifier. Elements may be omitted % if unavailable. For example, \texttt{en-GB.UTF-8} has the % \meta{modifier} omitted, and \texttt{en} has all but the language % omitted. As above, the punctuation characters will actually be % returned using the control sequences \cs{fhyn} (hyphen), \cs{fdot} % (dot) and \cs{fatc} (at). % %If the \longarg{encoding} option is used, the codeset will reflect %that value. % %\subsubsection{Action \shortarg{l} or \longarg{locale-lcs}} % %This action is similar to \longarg{locale}, but the codeset is converted to %lower case and any hyphens are stripped. For example, if \longargfmt{locale} %returns \texttt{en-GB.UTF-8}, then \longargfmt{locale-lcs} would return %\texttt{en-GB.utf8}. As above, the punctuation characters will actually be % returned using the control sequences \cs{fhyn} (hyphen), \cs{fdot} % (dot) and \cs{fatc} (at). %Again, if the \longarg{encoding} option is used, the codeset will reflect %that value. % %\subsubsection{Action \shortarg{cs} or \longarg{codeset}} % %(New to version 1.6.) This action returns just the codeset. %For example, my default file encoding is \gls{UTF}-8, so %\begin{verbatim} %texosquery --codeset %\end{verbatim} %returns %\begin{verbatim} %UTF-8 %\end{verbatim} %whereas %\begin{verbatim} %texosquery --encoding ISO-8859-1 --codeset %\end{verbatim} %returns %\begin{verbatim} %ISO-8859-1 %\end{verbatim} %(In both the above examples, the hyphen character is actually %returned as the control sequence \cs{fhyn}.) % %\subsubsection{Action \shortarg{C} or \longarg{codeset-lcs}} % %(New to version 1.2.) %This action returns just the codeset converted to lower case with hyphens %stripped. For example, my default file encoding is \gls{UTF}-8, so %\begin{verbatim} %texosquery -C %\end{verbatim} %returns %\begin{verbatim} %utf8 %\end{verbatim} %whereas %\begin{verbatim} %texosquery --encoding ISO-8859-1 -C %\end{verbatim} %returns %\begin{verbatim} %iso88591 %\end{verbatim} % %\subsubsection{Action \shortarg{o} or \longarg{osname}} % %This action displays the operating system name. For example, for me this %produces: %\begin{verbatim} %Linux %\end{verbatim} % %\subsubsection{Action \shortarg{r} or \longarg{osversion}} % %This action displays the operating system version. For example, for me this %produces: %\begin{verbatim} %4\fdot 1\fdot 13\fhyn 100\fdot fc21\fdot x86\fusc 64 %\end{verbatim} %(which expands to \texttt{4.1.13-100.fc21.x86\_64} when used with %\cs{TeXOSQuery}). % %\subsubsection{Action \shortarg{a} or \longarg{osarch}} % %This action displays the operating system architecture. For example, for me %this produces: %\begin{verbatim} %amd64 %\end{verbatim} % %\subsubsection{Action \shortarg{M} or \longarg{date-time}} %(New to version 1.2.) %This action displays all the current date time data in a format %suitable for use in \cs{texosqueryfmtdatetime}. (See %section~\ref{sec:applydatetimepatterns}.) % %\subsubsection{Action \shortarg{Z} \oarg{locale} or %\longarg{time-zones} \oarg{locale}} %(New to version 1.2.) %This action displays all of the time zone mappings %for the given locale (or the default if \meta{locale} is omitted) in the format %\begin{definition} %\{\marg{id$_1$}\marg{short name}\marg{long %name}\marg{dst short name}\marg{dst long name}\}\ldots %\{\marg{id$_{n}$}\marg{short name}\marg{long %name}\marg{dst short name}\marg{dst long name}\} %\end{definition} %The \meta{id} is the unique label used by Java to identify the time %zone (such as \texttt{Europe/London}) as used in the time zone %information returned by \shortarg{M} (\longarg{date-time}). % %\subsubsection{Action \shortarg{n} or \longarg{pdfnow}} % %This action displays the current date and time in PDF format. For example %\begin{verbatim} %\pdfd \fcln 20160704131006\fpls 01\fapo 00\fapo %\end{verbatim} %This uses the shorthand tags \cs{pdfd}, \cs{fcln}, \cs{fpls} and %\cs{fapo} that %are locally redefined by %\cs{TeXOSQuery} to produce a \texttt{D}, a colon (\texttt{:}), a %plus sign (\texttt{+}) and an apostrophe (\texttt{\textquotesingle}) %with the category code set to 12 to make it consistent with %\cs{pdfcreationdate}. This also allows %for situations where the punctuation characters have been made %active (for example, through \sty{babel}). % %Some, but not all, \TeX\ formats provide %\cs{pdfcreationdate}, which is more efficient than using the shell %escape, but this can be used %as a fallback method for those that don't (for example, \XeTeX). % %Note that versions 1.0 and 1.1 didn't use \cs{pdfd} etc but simply used %the actual characters. For example: %\begin{verbatim} %D:20160704131006+01'00' %\end{verbatim} %If you want to reproduce this format, use \longarg{compatible} %with the level set to 0 or 1. % %\subsubsection{Action \shortarg{d} \meta{file} or \longarg{pdfdate} %\meta{file}} % %This action displays the last modified time stamp of the given file in PDF format or a blank line % if the file doesn't exist or the file permissions prohibit this % action. %Again some, but not all, \TeX\ formats provide %\cs{pdffilemoddate}\marg{file}, which is more efficient than using %the shell escape. % %As with \longarg{pdfnow} this now uses \cs{pdfd} etc which are converted %by \cs{TeXOSQuery} to characters with the category code set to 12. % %This action obeys the \texttt{openin\_any} setting, so if access to %\meta{file} is forbidden by this setting, the result will be empty. % %\subsubsection{Action \shortarg{s} \meta{file} or \longarg{filesize} %\meta{file}} % %This action displays the size in bytes of the given file or an %empty string if the file doesn't exist or the file permissions prohibit this %action. Some, but not all, \TeX\ formats provide %\cs{pdffilesize}\marg{file}, which is more efficient than using %the shell escape. % %This action obeys the \texttt{openin\_any} setting, so if access to %\meta{file} is forbidden by this setting, the result will be empty. % %\subsubsection{Action \shortarg{c} or \longarg{cwd}} % %This action displays the current working directory. This obeys the %\texttt{openin\_any} setting, so this action will return an empty %string if this file information is forbidden by that setting. % %\subsubsection{Action \shortarg{m} or \longarg{userhome}} % %This action displays the user's home directory. This obeys the %\texttt{openin\_any} setting, so this action will return an empty %string if this file information is forbidden by that setting. % %\subsubsection{Action \shortarg{t} or \longarg{tmpdir}} % %This action displays the temporary directory. This obeys the %\texttt{openin\_any} setting, so this action will return an empty %string if this file information is forbidden by that setting. % %\subsubsection{Action \shortarg{i} \meta{sep} \meta{dir} \oarg{sort} or \longarg{list} %\meta{sep} \meta{dir} \oarg{sort}} % %This action lists all files in the given directory with the output on a single %line using \meta{sep} as the separator between entries. Note that %the list doesn't include the full path, just the file names. % %\begin{important} %As from v1.2, new restrictions have been placed on the value of \meta{dir} %for security reasons. For all three applications, %\app{texosquery-jre8}, \app{texosquery} and \app{texosquery-jre5}, %the \hyperref[sec:fileaccess]{\texttt{openin\_any} setting} is checked. If read access to %\meta{dir} is forbidden by the \texttt{openin\_any} setting, then %this action returns an empty string. \emph{Additionally}, %regardless of \texttt{openin\_any}, the more restrictive %applications, \app{texosquery-jre8} and \app{texosquery}, prohibit a %value of \meta{dir} that's outside the current working directory %path (e.g.\ \texttt{..}) or that has no parent directory (e.g.\ \texttt{/}). %Both \app{texosquery-jre8} and \app{texosquery} check the %\emph{canonical path} of \meta{dir}, so if \meta{dir} is a symbolic %link, the target path is checked. % %This is a security feature to prevent %any malicious code that might try to recursively list the contents %of the entire filing system, which would hog resources, or that %might try to discover files outside the current working directory. An %exception is made for \app{texosquery-jre5} since that application %is already considered insecure (due to Java 5 and 6 being long %deprecated), so if you really need \meta{dir} as, say \texttt{..} (the %parent directory) or \texttt{/} (the root directory), you can use %\app{texosquery-jre5} (by redefining \cs{TeXOSInvokerName} before %using \cs{TeXOSQuery}) although this isn't recommended. It will %still obey the \texttt{openin\_any} setting, so the listing still %won't work with \app{texosquery-jre5} if the \texttt{openin\_any} %setting is set to \texttt{p} (paranoid). %\end{important} % %As from version 1.2, there is now an optional argument \meta{sort}, %which indicates how the returned list should be sorted. If omitted %\texttt{default} is assumed. Available values of \meta{sort}: %\begin{description} %\item[\texttt{default}] Use the default order. This is typically in %alphabetical order, but depends on the operating system or %\gls{JRE}. %\item[\texttt{date-ascending}] Order by file modified date from %oldest to newest. This option has synonyms \texttt{date} and %\texttt{date-asc}. %\item[\texttt{date-descending}] Order by file modified date from %newest to oldest. You may use the shorter \texttt{date-des} %value instead. %\item[\texttt{size-ascending}] Order by file size from %smallest to largest. This option has synonyms \texttt{size} and %\texttt{size-asc}. %\item[\texttt{size-descending}] Order by file size from %largest to smallest. You may use the shorter \texttt{size-des} %value instead. %\item[\texttt{name-ascending}] Order by file name (case-sensitive) %alphabetically. This option has synonyms \texttt{name} and %\texttt{name-asc}. %\item[\texttt{name-descending}] Order by file name (case-sensitive) %in reverse alphabetic order. You may use the shorter %\texttt{name-des} value instead. %\item[\texttt{iname-ascending}] Order by file name (case-insensitive) %alphabetically. This option has synonyms \texttt{iname} and %\texttt{iname-asc}. %\item[\texttt{iname-descending}] Order by file name (case-insensitive) %in reverse alphabetic order. You may use the shorter %\texttt{iname-des} value instead. %\item[\texttt{ext-ascending}] Order by file extension (case-sensitive) %alphabetically. If files have the same extension, they are ordered %by name. This option has synonyms \texttt{ext} and %\texttt{ext-asc}. %\item[\texttt{ext-descending}] Order by file extension (case-sensitive) %in reverse alphabetic order. If files have the same extension, they are %ordered by name (reverse alphabetic order). You may use the shorter %\texttt{ext-des} value instead. %\end{description} % %This action obeys the \texttt{openin\_any} setting for all the %listed files as well as for the directory \meta{dir}, so if access to %a file in the directory is forbidden, the file will be omitted from %the list. (This action is equivalent to the following with %\meta{regex} set to \texttt{.*} to match all files.) % %If you want to excluded hidden dot files (where they aren't %automatically excluded by \texttt{openin\_any}), use the %\longarg{filterlist} action described below with \meta{regex} set %to \verb|[^\.].*|. (Remember that you'll need to use \cs{string} %when using the shell escape, as noted below.) % %\begin{important} %Unlike most of the return values the \meta{sep} part here isn't %escaped, so take care if \meta{sep} contains any commands. For %example, if you want to use \verb|\\| as the separator, you'll need %to use \verb|\string\noexpand\string\\| in the \meta{sep} part %within \cs{TeXOSQuery}. %\end{important} % %For example: %\begin{verbatim} %\TeXOSQueryFileList{\result}{\string\noexpand\string\\}{.} %\end{verbatim} %calls (through the shell escape): %\begin{verbatim} %texosquery -i '\noexpand\\' '.' %\end{verbatim} %(the two \cs{string} commands have detokenized their arguments) %so \app{texosquery} uses \verb|\noexpand\\| as the separator in the %returned list, but this list is expanded as it's read in. However %\cs{noexpand} prevents the \verb|\\| from being expanded, so the %separator becomes just \verb|\\| which may be (re)defined before the %resulting list is processed. % %Note that \cs{TeXOSQueryFileList} automatically adds the single %quotes around the arguments. If \cs{TeXOSQuery} is used explicitly, %these quotes would need to be added as appropriate. % %\subsubsection{Action \shortarg{id} \meta{sep} \meta{dir} %\oarg{sort} or \longarg{list-dir} %\meta{sep} \meta{dir} \oarg{sort}} % %This action is like \longarg{list} but only includes sub-directories %of \meta{dir}. The caveats and security notes for \longarg{list} also apply %here. % %\subsubsection{Action \shortarg{ir} \meta{sep} \meta{dir} %\oarg{sort} or \longarg{list-regular} %\meta{sep} \meta{dir} \oarg{sort}} % %This action is like \longarg{list} but only includes regular files. %The caveats and security notes for \longarg{list} also apply here. % %\subsubsection{Action \shortarg{f} \meta{sep} \meta{regex} \meta{dir} %\oarg{sort} or \longarg{filterlist} \meta{sep} \meta{regex} \meta{dir} %\oarg{sort}} % %This action is like \longarg{list} but only lists those files whose name %matches the %\href{http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html}{regular expression} given in \meta{regex}. Note that %since this uses Java's \texttt{String.matches} method this tests for a %\emph{complete} match on the file name (not including directory path). For example, %if \meta{regexp} is \texttt{foo.*}, it will only match files whose %name starts with \texttt{foo} (for example, \texttt{foobar} will %match but \texttt{barfoo} won't). Use \texttt{.*foo.*} to match all %files that contain \texttt{foo} in the name (so \texttt{foobar} and %\texttt{barfoo} will both match). % %\begin{important} %You can't have an empty regular expression. You can use the regular %expression \texttt{.*} to match all files (which is what %\longarg{list} does). %\end{important} % %As from version 1.2, this action now has an optional argument %\meta{sort}, which indicates how to sort the returned list. The %available values for \meta{sort} are the same as for %\longarg{list}, described above. % %The caveats and security notes for \longarg{list} also apply here. % %\subsubsection{Action \shortarg{fd} \meta{sep} \meta{regex} \meta{dir} %\oarg{sort} or \longarg{filterlist-dir} \meta{sep} \meta{regex} \meta{dir} %\oarg{sort}} % %This action is like \longarg{filterlist} but only includes %sub-directories of \meta{dir}. % %The caveats and security notes for \longarg{list} also apply here. % %\subsubsection{Action \shortarg{fr} \meta{sep} \meta{regex} \meta{dir} %\oarg{sort} or \longarg{filterlist-regular} \meta{sep} \meta{regex} \meta{dir} %\oarg{sort}} % %This action is like \longarg{filterlist} but only includes %regular files. % %The caveats and security notes for \longarg{list} also apply here. % %\subsubsection{Action \shortarg{w} \meta{sep} \meta{regex} \meta{dir} %\oarg{sort} or \longarg{walk} %\meta{sep} \meta{regex} \meta{dir} \oarg{sort}} % %(New to version 1.2. Not available with \app{texosquery-jre5}.) % %This action starts from the directory \meta{dir} \emph{which must %be on the current working directory's path} and returns a list %separated by \meta{sep} of all the regular files whose basename matches %the regular expression \meta{regex} (as for the filtered file %listings described above), recursively descending %sub-directories. Any files or sub-directories that are hidden, unreadable %or symbolic links are skipped. The list is sorted %according to \meta{sort}, which is as for the file listing actions %described above. Note that \meta{dir} is first converted to its %canonical path, so if \meta{dir} is a symbolic link, the %security check will test if the \emph{target} path is on the %current working directory path. % %As with the above file listings, the separator \meta{sep} isn't %escaped so take care if \meta{sep} contains any commands. The %resulting list will consist of paths relative to \meta{dir}. % %\begin{important} %This action requires at least Java 7 so it's not available with %\file{texosquery-jre5.jar}. %\end{important} % %\subsubsection{Action \shortarg{u} \meta{file} or \longarg{uri} %\meta{file}} % %This action displays the URI of the given file or an empty string if the file %doesn't exist or if the file permissions or the %\texttt{openin\_any} setting prohibit read access. % %\subsubsection{Action \shortarg{p} \meta{file} or \longarg{path} %\meta{file}} % %This action displays the canonical path of the given file or an %empty string if the file doesn't exist or if the file permissions %or the \texttt{openin\_any} setting prohibit this action. % %\subsubsection{Action \shortarg{e} \meta{file} or \longarg{dirname} %\meta{file}} % %(New to v1.1.) %This action displays the canonical path of the given file's parent (that is, the %directory containing \meta{file}) or an empty string if %the file doesn't exist or if the file permissions or the %\texttt{openin\_any} setting prohibits this %action. Note that this is different to the Unix-like %\app{dirname} command, which will return a relative path if %\meta{file} isn't an absolute path. % %\subsubsection{Action \shortarg{N} \oarg{language tag} or \longarg{numeric} %\oarg{language tag}} % %(New to v1.2.) This action displays: %\begin{definition} %\marg{locale tag}\marg{group sep}\marg{decimal sep}\marg{exp %sep}\marg{use group}\marg{currency code}\marg{regional currency %code}\marg{currency sym}\marg{\TeX\ currency}\marg{currency sep} %\end{definition} %for the \meta{language tag} given in the optional argument. If omitted, the %default locale is assumed. The returned values are: %\begin{itemize} %\item \meta{tag} the language tag. %\item \meta{group sep} the numeric group separator. %\item \meta{decimal sep} the decimal separator. %\item \meta{exp sep} the exponent separator. %\item \meta{use group} \texttt{1} if the locale uses number %grouping otherwise \texttt{0}. %\item \meta{currency code} the ISO 4217 currency code. %\item \meta{regional currency code} either the ISO 4217 currency %code or an unofficial code. The only unofficial codes returned are: %GGP (Guernsey pound), JEP (Jersey pound), IMP (Isle of Man %pound), KID (Kiribati dollar) and TVD (Tuvaluan dollar). %\item \meta{currency sym} the currency symbol. (This may sometimes be %the same as \meta{currency code}.) Non-ASCII characters will be %marked up with \cs{twrp} (see below). %\item \meta{\TeX\ currency} the currency symbol using \TeX\ code %provided by \sty{texosquery}. %This is obtained by substituting known Unicode %currency symbols occurring in \meta{currency sym} with %\cs{texosquerycurrency}\marg{xxx}, which expands to the control %sequence given by the name \texttt{texosquerycurrency}\meta{xxx}. %These commands are defined in \file{texosquery.tex}. Since there are no generic \TeX\ commands %available for all these symbols (except \$), these commands will need to be %redefined as appropriate but are provided in the event that there's %no UTF-8 support. There is a limited check for some known currency %commands, such as \cs{texteuro} or \cs{euro}, but if an appropriate %currency command can't be found, the %\cs{texosquerycurrency}\meta{xxx} commands will be defined to %simply the currency label (usually the same as the \meta{xxx} %part). % %\item \meta{currency sep} the currency decimal separator. %\end{itemize} %The language tag should conform to \gls{IETF} \gls{BCP}~47. See %\url{http://docs.oracle.com/javase/8/docs/api/java/util/Locale.html} %for further details. If you are using \app{texosquery-jre5}, %only the language, region and variant elements will be recognised %since the language tag support was introduced in Java~7. % %For example: %\begin{verbatim} %texosquery -N en-GB %\end{verbatim} %produces %\begin{verbatim} %{en-GB}{,}{.}{E}{1}{GBP}{GBP}{\twrp{£}}{\texosquerycurrency{pound}}{.} %\end{verbatim} %The \cs{twrp} command is used by \app{texosquery} to markup a %non-\gls{ASCII} character. This command is one of the shorthands only %defined within \cs{TeXOSQuery}. In this case it's a shortcut for %the command \cs{texosquerynonasciiwrap}. By default this just does its %argument, but it may be redefined to perform some other action such %as converting from one encoding to another. % %In most cases the \meta{regional currency code} will be the same %as \meta{currency} code. A few non-ambiguous unofficial codes %are known by \app{texosquery} and may be used if the country code %is recognised. For example, %\begin{verbatim} %texosquery -N en-IM %\end{verbatim} %produces %\begin{verbatim} %{en-IM}{,}{.}{E}{1}{GBP}{IMP}{M\twrp{£}}{M\texosquerycurrency{pound}}{.} %\end{verbatim} % %If Java doesn't support the given locale, the currency code will %appear as \texttt{XXX} with the symbol \textcurrency\ (generic %currency sign). % %\begin{important} %This option and the following (\longarg{locale-data}) are best used %with \XeTeX\ or \LuaTeX\ to deal with the non-\gls{ASCII} characters. %Make sure the file encoding used by Java matches the \TeX\ file. %\end{important} % %(See section~\ref{sec:locales} for the difference in locale %providers.) % %\subsubsection{Action \shortarg{D} \oarg{language tag} or %\longarg{locale-data} \oarg{language tag}} % %(New to v1.2.) This action provides more %extensive information than \longarg{numeric}. %The result has nested groups to assist parsing. %Again the \meta{language tag} may be omitted. For example, %\begin{verbatim} %texosquery --locale-data %\end{verbatim} %For the default locale or %\begin{verbatim} %texosquery --locale-data en-GB %\end{verbatim} %for the locale identified by \texttt{en-GB}. %As with all the other actions, the result is written to STDOUT on a %single line. Its overall length and the use of the shortcut %commands used by \app{texosquery} to markup certain elements mean %that it's not particularly human-readable, but it's designed to be %easy for \TeX\ to interpret. The information is returned in the %following format: %\begin{definition} %\marg{locale block}\marg{current date block}\marg{date pattern %block}\marg{current time block}\allowbreak\marg{time pattern %block}\marg{current date time block}\marg{date time pattern block}\marg{days %of the week block}\marg{abbreviated dates of the week %block}\marg{month names block}\marg{abbreviated month names %block}\marg{standalone days of the week block}\marg{abbreviated %standalone days of the week block}\marg{standalone month names %block}\marg{abbreviated standalone month names block}\marg{numeric %block}\marg{numeric patterns block} %\end{definition} %There may seem to be some repetition here with the month and week %day names, but with \app{texosquery-jre8}, the second set are the %standalone version (for example, for a column header). In some %languages, these may be different from the names used in the date %format. Since this is new to Java 8, it's not supported in %\file{texosquery.jar} or \file{texosquery-jre5.jar} and they simply reproduce %the non-standalone names. % %The information supplied with this option is quite complex, %but it's used by the \sty{tex-locale} package to set up all the %required information for each locale used in the document. %Any non-\gls{ASCII} characters are marked up with \cs{twrp}, %which is locally defined by \cs{TeXOSQuery} to expand to %\cs{texosquerynonasciiwrap}. This may be redefined to deal with the %characters if necessary. For example, if the character needs to be %converted from one encoding to another. % %The blocks are: %\begin{description} %\item \meta{locale block} % %The locale information in the form: %\begin{definition} %\marg{tag}\marg{language name}\marg{locale language %name}\marg{region name}\marg{locale region name}\marg{variant %name}\marg{locale variant name} %\end{definition} %The \meta{tag} is the language tag (the same format as \longarg{bcp47}). % %The \meta{language name} is the language name in the operating %system's default locale. % %The \meta{locale language name} is the language name in %the locale's language. % %For example, my locale is \texttt{en-GB}, so if I use %\begin{verbatim} %texosquery -D en-GB %\end{verbatim} %then both \meta{language name} and \meta{locale language name} will %be \texttt{English}, but if I use: %\begin{verbatim} %texosquery -D fr-GB %\end{verbatim} %then \meta{language name} will be \texttt{French} and the \meta{locale %language name} will be \texttt{fran\cs{twrp}\char`\{\c{c}\char`\}ais} (note the non-ASCII %character has been marked up). The locale tag \verb|fr-GB| %indicates that I'm writing in French but I'm in the United Kingdom %(so the currency should be GBP). % %The \meta{region name} is the region's name in the operating %system's default language. % %The \meta{locale region name} is the region's name in the locale's language. % %So for me with \texttt{-D en-GB} I get %\verb|United\tspc Kingdom| for both \meta{region name} and %\meta{locale region name}. This illustrates another of the %shorthand commands that \app{texosquery} uses that's only locally %defined within \cs{TeXOSQuery}. In this case, \cs{tspc} just expands %to a space. This is used to avoid accidentally discarding any %intentional spaces that might follow a command name or any %intentional consecutive spaces. % %If, however, I use \texttt{-D fr-GB} I still get %\verb|United\tspc Kingdom| in \meta{region name}, but \meta{locale %region name} is now \verb|Royaume-Uni|. % %The \meta{variant name} is the language's variant. For example, %with \verb|de-CH-1996| (Swiss German using the new orthography), %the variant is 1996. There's no variant in \verb|en-GB| so this %value is empty for me. % %The \meta{locale variant name} is the variant in the locale's %language. In the case of \verb|de-CH-1996| this is still 1996. % %\item \meta{current date block} % %This returns the current date in four different formats and also an %integer that indicates the first day of the week in the given %locale: %\begin{definition} %\marg{full date}\marg{long date}\marg{medium date}\marg{short %date}\marg{first day} %\end{definition} %The actual date formats depend on the locale. For example, with %\texttt{en-GB} the \meta{full date} is (assuming today is %2016-11-08): %\begin{verbatim} %Tuesday,\tspc 8\tspc November\tspc 2016 %\end{verbatim} %(Tuesday, 8 November 2016). %The \meta{long date} is %\begin{verbatim} %08\tspc November\tspc 2016 %\end{verbatim} %(08 November 2016). %The \meta{medium date} is %\begin{verbatim} %08\thyn Nov\thyn 2016 %\end{verbatim} %(08-Nov-2016). %The \meta{short date} is %\begin{verbatim} %08\tslh 11\tslh 16 %\end{verbatim} %(08/11/2016). %Note that there's a difference between using the \gls{CLDR} locale data %and the JRE data. If I'm using the Java~7 compatible %\app{texosquery.jar} which only uses JRE locale data, then I get %the above results, but if I use the bash script \file{texosquery-jre8} which %sets \texttt{java.locale.providers} to \texttt{CLDR,JRE} then I get %a slightly different result. The \meta{long date} is %\begin{verbatim} %8\tspc November\tspc 2016 %\end{verbatim} %(8 November 2016) %and the \meta{medium date} is %\begin{verbatim} %8\tspc Nov\tspc 2016 %\end{verbatim} %(8 Nov 2016). %The \meta{medium date} may be numeric or may be an abbreviated %form of \meta{long date}, depending on the language and the locale %provider. Some languages aren't supported by \gls{JRE} but are supported %by \gls{CLDR}. (Some aren't supported by either, but there's a %chance that those languages will eventually be added to the CLDR.) %For example, if I use \texttt{-D cy-GB} with the JRE as the locale %provider I just get the \texttt{en-GB} dates, but if I use the CLDR %provider I get Welsh dates. % %Note that the proposed Java~9 should automatically use the CLDR as %the locale provider, which is being increasingly adopted by %applications as a common data repository. % %The first day of the week index is zero-based starting with Monday. %This is done in order to be compatible with \sty{pgfcalendar}. For %example, with \texttt{-D en-GB} \meta{first day} is 0 (Monday), but %with \texttt{pt-BR} \meta{first day} is 6 (Sunday). The %\sty{tex-locale} package provides a way of converting the index to %Monday=1 or Sunday=1 indexing. % %\item \meta{date pattern block} % %The pattern used to format the full date, long date, medium %date and short date. This is in the form: % %\marg{full pattern}\marg{long pattern}\marg{medium %pattern}\marg{short pattern} % %Each pattern uses shorthand mark-up that's only locally defined %within \cs{TeXOSQuery}. These short commands are expanded to longer %commands provided by \file{texosquery.tex} to avoid name clashing %with other packages. When used directly in the document text, these %expand to reproduce the pattern. % %For example, with \texttt{-D en-GB} I get the following %pattern for the short date: %\begin{verbatim} %\patdtf{2}{d}\tslh \patdtf{2}{M}\tslh \patdtf{2}{y} %\end{verbatim} %When parsed by \cs{TeXOSQuery}, this is internally converted to %\begin{verbatim} %\texosquerydtf{2}{d}/\texosquerydtf{2}{M}/\texosquerydtf{2}{y} %\end{verbatim} %But default this simply expands to \texttt{dd/MM/yy} but may be %used in the first argument of \cs{texosqueryfmtdatetime}. See %sections~\ref{sec:patternformats} and \ref{sec:applydatetimepatterns} for %further details. % %\item \meta{current time block} % %The current time provided in various formats suitable to the %given locale: %\begin{definition} %\marg{full time}\marg{long time}\marg{medium time}\marg{short time} %\end{definition} %As with the current date, the actual format depends on the locale %and the locale provider. For example, with \texttt{en-GB} I get: %\begin{verbatim} %{15:59:41\tspc o\csq clock\tspc GMT}{15:59:41\tspc GMT}{15:59:41}{15:59} %\end{verbatim} %with the \gls{JRE}. If I switch to \gls{CLDR} (in the bash script \file{texosquery-jre8}) I get: %\begin{verbatim} %{16:00:51\tspc Greenwich\tspc Mean\tspc Time}{16:00:51\tspc GMT}{16:00:51}{16:00} %\end{verbatim} % %\item \meta{time pattern block} % %The pattern used to format the full time, long time, medium %time and short time. % %\marg{full time pattern}\marg{long time pattern}\marg{medium time %pattern}\marg{short time pattern} % %Again, when used with \cs{TeXOSQuery}, the short commands, such as %\cs{patdtf}, are internally converted. %They're not defined outside that scope. % %\item \meta{current date time block} % %The current date and time provided in various formats suitable to the %given locale: %\begin{definition} %\marg{full date time}\marg{long date time}\marg{medium date %time}\marg{short date time} %\end{definition} %This may simply be the date and time from above separated by %a space. % %\item \meta{date time pattern block} % %The pattern used to format the full date time, long date time, medium %date time and short date time. This may simply be the date and %time patterns from above separated by a space. %\begin{definition} %\marg{full date time pattern}\marg{long date time %pattern}\marg{medium date time pattern}\marg{short date time pattern} %\end{definition} % %\item \meta{days of the week block} % %The week day names (starting with Monday for consistency with %\sty{pgfcalendar}) in the locale's language. Non-\gls{ASCII} characters are marked up with %\cs{twrp}. %\begin{definition} %\marg{Monday}\marg{Tuesday}\marg{Wednesday}\marg{Thursday}\marg{Friday}\marg{Saturday}\marg{Sunday} %\end{definition} %\item \meta{abbreviated days of the week block} % %As above, but abbreviated. % %\item \meta{month names block} % %The month names. % %\item \meta{abbreviated month names block} % %The abbreviated month names. % %\item \meta{standalone days of the week block} % %The week day names when used in a standalone context (for example, a %column header). This may be the same as the earlier \meta{days of %the week block} (and will be the same for \file{texosquery.jar} and %\file{texosquery-jre5.jar}). The standalone support was %introduced to Java~8. % %\item \meta{abbreviated standalone days of the week block} % %As above, but abbreviated. % %\item \meta{standalone month names block} % %The month names when used in a standalone context (for example, a %column header). This may be the same as the earlier \meta{month %names block} (and will be the same for \file{texosquery.jar} and %\file{texosquery-jre5.jar}). The standalone support was %introduced to Java~8. % %\item \meta{abbreviated standalone month names block} % %As above but abbreviated. % %\item \meta{numeric block} % %The numeric data similar to \longarg{numeric} but it's %missing the \meta{tag} (which is provided in the earlier %\meta{locale block}) and there are two extra items: %\begin{definition} %\marg{group sep}\marg{decimal sep}\marg{exp %sep}\marg{use group}\marg{currency code}\marg{regional currency %code}\marg{currency sym}\marg{currency tex}\marg{currency sep} %\marg{percent sym}\marg{per mill sym} %\end{definition} %See above for the elements that are also provided in %\longarg{numeric}. The additional elements are \meta{percent sym} %and \meta{per mill sym}, which are the percent and %per-mill symbols, respectively. The percent symbol \verb|%| has its %category code changed to 12 by \cs{TeXOSQuery}. As with other %non-ASCII characters, the per-mill symbol will be marked up with %\cs{twrp}. % %\item \meta{numeric patterns block} % %The patterns used to format decimals, integers, currency and %percentages. %\begin{definition} %\marg{decimal pattern}\marg{integer pattern}\marg{currency %pattern}\marg{percentages pattern} %\end{definition} %As with the date and time patterns, when used with \cs{TeXOSQuery}, the %short commands, such as \cs{patdgt}, are internally converted. %They're not defined outside that scope. % %If a pattern is used directly in the text, it will expand to the %original pattern padded to ten digits. (Eleven digit integers are outside %\TeX's maximum number range.) % %Any of these numeric patterns may be used in the first argument of %the low-level user command \cs{texosqueryfmtnumber} described in %section~\ref{sec:applynumpatterns}. This command uses the following %macros: %\begin{definition} %\cs{texosquerypatfmtcurrencysign} %\end{definition} %The currency sign (defaults to \verb|\$|). For example, when parsing the previous %\meta{numeric block}, this command can be redefined to the \marg{currency sym} or %\marg{currency tex} elements. % %\begin{definition} %\cs{texosquerypatfmtgroupsep} %\end{definition} %The group separator (defaults to \verb|,|). For example, when parsing the previous %\meta{numeric block}, this command can be redefined to the %\marg{group sep} element. % %\begin{definition} %\cs{texosquerypatfmtdecsep} %\end{definition} %The decimal separator (defaults to \verb|.|). For example, when parsing the previous %\meta{numeric block}, this command can be redefined to the %\marg{dec sep} element. % %\begin{definition} %\cs{texosquerypatfmtcurdecsep} %\end{definition} %The monetary decimal separator (defaults to \verb|.|). For example, when parsing the previous %\meta{numeric block}, this command can be redefined to the %\marg{currency sep} element. % %\begin{definition} %\cs{texosquerypatfmtexp} %\end{definition} %The exponent sign (defaults to \texttt{E}). For example, when parsing the previous %\meta{numeric block}, this command can be redefined to the %\marg{exp sep} element. % %\begin{definition} %\cs{texosquerypatfmtpercentsign} %\end{definition} %The percent symbol. For example, when parsing the previous %\meta{numeric block}, this command can be redefined to the %\marg{percent sym} element. % %\begin{definition} %\cs{texosquerypatfmtpermillsign} %\end{definition} %The per-mill symbol. For example, when parsing the previous %\meta{numeric block}, this command can be redefined to the %\marg{per-mill sym} element. % %\begin{definition} %\cs{texosquerypatfmticurrencysign} %\end{definition} %The international currency sign. This is defined as \texttt{¤} by %default, unless the command \cs{textcurrency} has been defined, in %which case that's used instead. If the UTF-8 character ¤ is %available and \cs{textcurrency} hasn't been defined before %\sty{texosquery} was input, then you will need to redefine this %command as appropriate. % %\begin{definition} %\cs{texosquerypatfmtminus} %\end{definition} %The minus sign. % %\begin{definition} %\cs{texosquerypatfmtplus} %\end{definition} %The plus sign. % %\end{description} % %\section{texosquery.tex: generic \TeX\ code} %\label{sec:tex} %You can run \app{texosquery} directly from \TeX's shell escape. %For example: %\begin{verbatim} %\input|"texosquery --locale" %\end{verbatim} %However, \app{texosquery} uses markup commands in some of %the results which need to be defined first. The file %\file{texosquery.tex} provides generic \TeX\ code to do %this for you and stores the result in a control sequence. % %Plain \TeX\ users can input this file through the usual \cs{input} %method: %\begin{verbatim} %\input texosquery %\end{verbatim} %\LaTeX\ users may also simply input this file: %\begin{verbatim} %\input{texosquery} %\end{verbatim} %but may prefer the standard package approach: %\begin{verbatim} %\usepackage{texosquery} %\end{verbatim} % %\begin{important} %The commands described below are all fragile. %\end{important} % %The basic command to run \app{texosquery} and capture its output %in a control sequence is: %\begin{definition} %\ics{TeXOSQuery}\marg{cs}\marg{args} %\end{definition} %where \meta{cs} is the control sequence in which to store the %result and \meta{args} are the command line arguments to pass to %\app{texosquery}. This first locally changes the category code %of some problematic characters and defines the short markup %commands that \app{texosquery} uses to identify characters that %need to be interpreted literally (for example, in file names). %These commands will automatically be expanded by \cs{TeXOSQuery} %when the result is input. For example %\begin{verbatim} %texosquery -n %\end{verbatim} %produces %\begin{verbatim} %\pdfd \fcln 20161129221559\fpls 00\fapo 00\fapo %\end{verbatim} %but when used with %\begin{verbatim} %\TeXOSQuery{\result}{texosquery -n} %\end{verbatim} %the \cs{result} command will be set to %\begin{verbatim} %D:20161129221559+00'00' %\end{verbatim} %where the characters \texttt{D} \text{:} \texttt{+} and %\texttt{\textquotesingle} all have category code 12 (other). % %If you're not able to use \TeX's piped shell escape but you can %run \app{texosquery} outside of \TeX, then another approach is to %first run \app{texosquery} with the output redirected to a %temporary file and then build your document, but instead of using %\cs{TeXOSQuery}, use: %\begin{definition} %\ics{TeXOSQueryFromFile}\marg{cs}\marg{file name} %\end{definition} %where \meta{file name} is the name of the temporary file. For %example, first run %\begin{verbatim} %texosquery -b -n > tmpresult.tex %\end{verbatim} %and then in the document: %\begin{verbatim} %\TeXOSQueryFromFile{\result}{tmpresult} %\end{verbatim} %Avoid spaces and other awkward characters in the file name. % %In the case of \cs{TeXOSQuery}, if the command failed, \meta{cs} will be set %to empty. This will also occur with \cs{TeXOSQueryFromFile} if the %file doesn't exist. It's best to always test for success after use. %For example: %\begin{verbatim} %\TeXOSQuery{\result}{-b} %\ifx\result\empty % Failed! %\else % Result: \result. %\fi %\end{verbatim} % %In the case of \cs{TeXOSQuery}, failure can occur because the dry run mode %was on, or it can occur %if the query was denied (for example, forbidden file access), %or if there's a syntax error in the system call. In the case of %\cs{TeXOSQueryFromFile}, the control sequence will be empty if the %file doesn't exist or if the file was empty. % %As from %version 1.2, \app{texosquery} checks the \texttt{openin\_any} %setting, which may forbid read access. Java's security manager %or the filing system may also forbid read access. % %To determine the cause of the error, first inspect the log file to %check if the shell escape was used. In the above example, if %the shell escape was permitted, then the log file should include %\begin{verbatim} %(|texosquery -b) %\end{verbatim} %Copy and paste the system call (\verb|texosquery -b| in %the above case) into your %\href{http://www.dickimaw-books.com/latex/novices/html/terminal.html}{command %prompt or terminal} and insert %the \longarg{debug} switch at the start of the argument list. For %example: %\begin{verbatim} %texosquery --debug -b %\end{verbatim} %This should help determine whether it's a syntax error or a query forbidden %by the operating system. % %If multiple queries are required, it's more efficient to %perform them all in one go. For example: %\begin{verbatim} %\TeXOSQuery{\result}{-l -n -o} % %\def\parseresult#1#2#3{% % Locale: #1. Now: #2. OS: #3.% %} % %\ifx\result\empty % Query failed. %\else % \expandafter\parseresult\result %\fi %\end{verbatim} %(Make sure you have at least v1.1 for this to work correctly.) % %\begin{important} %Take care of characters that have a special meaning to your shell. %For example, bash interprets \verb|#| as a comment. For example, if %you have a file called \texttt{image\#1.png}, then you can't simply %do %\begin{verbatim} %\TeXOSQuery{\result}{-p image#1.png} %\end{verbatim} %since bash will pass this as %\begin{verbatim} %texosquery -p image %\end{verbatim} %(The \verb|#1.png| part is treated as a comment.) Nor can you do %\begin{verbatim} %\TeXOSQuery{\result}{-p image\#1.png} %\end{verbatim} %as \TeX\ will replace the \verb|\#| with \verb|#| when passing the %command invocation to the shell. The only way to deal with this %situation is to do %\begin{verbatim} %\TeXOSQuery{\result}{-p image\string\#1.png} %\end{verbatim} %to protect the \verb|#| character from both \TeX\ and the shell. %\end{important} % %Dry run mode is determined by the conditional %\begin{definition} %\ics{ifTeXOSQueryDryRun} %\end{definition} %If true, the shell escape won't be used and the requested command %invocation will be printed in the transcript file prefixed with %\begin{verbatim} %TeXOSQuery: %\end{verbatim} %(the control sequence \meta{cs} will be set to empty). % %\begin{important} %Remember that a query can still fail even if the dry run mode is %off. %\end{important} % %Note that if you switch off the dry run mode when the %shell escape setting forbids the execution of \app{texosquery}, %then you'll get the rather annoying error: %\begin{verbatim} %runpopen command not allowed: texosquery % %! I can't find file `"|texosquery -b"'. %\TeXOSQueryInvoker ...TeXOSInvokerName \space #1" % %\TeXOSQuery ...noexpand #1{\TeXOSQueryInvoker {#2} % }}\@texosquery@tmp \fi %l.5 \TeXOSQuery{\result}{-b} % ^^M %(Press Enter to retry, or Control-D to exit) %\end{verbatim} %By default, the dry run mode is only switched off if the %unrestricted shell escape mode is on (detected through %\cs{shellescape} or \cs{pdfshellescape}). % %If \app{texosquery} is added to the restricted list, you can add %\begin{verbatim} %\TeXOSQueryAllowRestricted %\end{verbatim} %to the \file{texosquery.cfg} file. (This command can't be used %outside of that file.) % %If you get the above error, then: %\begin{itemize} %\item make sure you don't have %\cs{TeXOSQueryAllowRestricted} in your \file{texosquery.cfg} %file; %\item make sure you run \TeX\ with the shell escape enabled; %\item check the definition of \cs{TeXOSInvokerName}; %\item try using the application directly from the command prompt or %terminal. For example, in the above message, the bit between %\texttt{\textasciigrave\textquotedbl\textbar} and %\texttt{\textquotedbl\textquotesingle} (that is, \texttt{texosquery-jre8 -b}) %shows the attempted system call. Copy and paste it directly %into your operating system's %\href{http://www.dickimaw-books.com/latex/novices/html/terminal.html}{command %prompt or terminal} and to check the application has been installed %correctly. %\end{itemize} % %The \cs{TeXOSQuery} command uses \ics{TeXOSInvokerName} to reference the %application name. This now defaults to \app{texosquery-jre8} (as %from \app{texosquery} version 1.7) but needs to be %redefined to reflect the particular system call that's required. %For example, \texttt{texosquery} (Java~7) or %\texttt{texosquery-jre5} (Java~5). This redefinition %can be done in the configuration file \file{texosquery.cfg} for a %system-wide setting. See section~\ref{sec:setup} for further %details. % %\begin{important} %Some of the shortcut commands listed below require extra arguments after the %relevant switch. These are automatically enclosed in single-quotes %to protect any spaces, but only with the \emph{unrestricted} shell escape. %If the argument actually contains any single-quote %characters, make sure you use \verb|\string\'| to prevent %interference. The quote character is forbidden in the shell escape %in restricted mode (see section~\ref{sec:restricted}), so the %arguments won't be delimited in this case and the quote character %should be avoided. % %Since a file name reference may need to be obtained from \cs{jobname}, %which sometimes includes double-quotes, the first double-quote pair %found is stripped in file name arguments. Any other double-quotes %will need to be protected in the same manner as single-quotes %(but this shouldn't be an issue if you use a safe file naming scheme) %and again be aware of the limitations imposed by the restricted %shell escape. % %All paths should use a forward slash for the directory divider. %\end{important} % %\subsection{Locale} %The locale (\shortarg{l} or \longarg{locale-lcs}) information can be %obtained using: %\begin{definition} %\ics{TeXOSQueryLocale}\marg{cs} %\end{definition} %Note that this uses the lower case codeset form, which has a better %chance of matching the encoding names used by the \sty{inputenc} %package. If you want the unprocessed codeset name, you can do: %\begin{definition} %\cs{TeXOSQuery}\marg{cs}\{\shortarg{L}\} %\end{definition} %If you just want the codeset in the same form as %\longarg{locale-lcs} you can do: %\begin{definition} %\cs{TeXOSQuery}\marg{cs}\{\shortarg{C}\} %\end{definition} %Similarly for the unprocessed codeset (\longarg{encoding}). % %The \gls{IETF} \gls{BCP}~47 language tag (\shortarg{b} or \longarg{bcp47}) %can be obtained using: %\begin{definition} %\ics{TeXOSQueryLangTag}\marg{cs} %\end{definition} % %The numeric separators and currency symbols (\shortarg{N} or %\longarg{numeric}) can be obtained using %\begin{definition} %\ics{TeXOSQueryNumeric}\marg{cs}\marg{locale} %\end{definition} %The \meta{locale} should be a valid language tag or may be empty %for the system's default locale. Similarly for the command below. % %All the locale data (\shortarg{D} or \longarg{locale-data}) can be %obtained using %\begin{definition} %\ics{TeXOSQueryLocaleData}\marg{cs}\marg{locale} %\end{definition} % %\subsection{Operating System Information} %The OS name (\shortarg{o} or \longarg{osname}) can %be obtained using: %\begin{definition} %\ics{TeXOSQueryName}\marg{cs} %\end{definition} % %The OS version (\shortarg{r} or \longarg{osversion}) can %be obtained using: %\begin{definition} %\ics{TeXOSQueryVersion}\marg{cs} %\end{definition} % %The OS architecture (\shortarg{a} or \longarg{osarch}) can %be obtained using: %\begin{definition} %\ics{TeXOSQueryArch}\marg{cs} %\end{definition} % %\subsection{Dates and Times} %The current date and time information (\shortarg{M} or %\longarg{date-time}) can be obtained using: %\begin{definition} %\ics{TeXOSQueryDateTime}\marg{cs} %\end{definition} %Example usage: %\begin{verbatim} %\texosquerydefpattern{\pattern}{\%2d/\%2M/\%4y \%2H:\%2m:\%2s} % %\TeXOSQueryDateTime{\datetimedata} % %\ifx\datetimedata\empty % Query Failed! %\else % \expandafter\texosqueryfmtdatetime\expandafter\pattern\datetimedata %\fi %\end{verbatim} %Note that commands such as \cs{texosqueryfmtpatMMM} will need to be %defined to produce textual elements. See %sections~\ref{sec:patternformats} and \ref{sec:applydatetimepatterns} for %further details. % %The time zone mappings (\shortarg{Z} or %\longarg{time-zones}) can be obtained using: %\begin{definition} %\ics{TeXOSQueryTimeZones}\marg{cs}\marg{locale} %\end{definition} %Leave \meta{locale} empty if the default locale is required. % %The current date-time stamp in PDF format (\shortarg{n} or %\longarg{pdfnow}) can be obtained using: %\begin{definition} %\ics{TeXOSQueryNow}\marg{cs} %\end{definition} %This is provided for the benefit of users who don't have %\cs{pdfcreationdate} defined by their \TeX\ format (for example, %\XeTeX). % %The modification date-time stamp in PDF format for a file %(\shortarg{d} or \longarg{pdfdate}) can be obtained using: %\begin{definition} %\ics{TeXOSQueryFileDate}\marg{cs}\marg{filename} %\end{definition} %where \meta{filename} is the name of the file. %This is provided for the benefit of users who don't have %\cs{pdffilemoddate} defined by their \TeX\ format. % %\subsection{File Operations} %The current working directory (\shortarg{c} or \longarg{cwd}) can %be obtained using: %\begin{definition} %\ics{TeXOSQueryCwd}\marg{cs} %\end{definition} % %The home directory (\shortarg{m} or \longarg{userhome}) can %be obtained using: %\begin{definition} %\ics{TeXOSQueryHome}\marg{cs} %\end{definition} % %The temporary directory (\shortarg{t} or \longarg{tmpdir}) can %be obtained using: %\begin{definition} %\ics{TeXOSQueryTmpDir}\marg{cs} %\end{definition} % %The size in bytes of a file %(\shortarg{s} or \longarg{filesize}) can be obtained using: %\begin{definition} %\ics{TeXOSQueryFileSize}\marg{cs}\marg{filename} %\end{definition} %where \meta{filename} is the name of the file. %This is provided for the benefit of users who don't have %\cs{pdffilesize} defined by their \TeX\ format. % %The URI of a file %(\shortarg{u} or \longarg{uri}) can be obtained using: %\begin{definition} %\ics{TeXOSQueryFileURI}\marg{cs}\marg{filename} %\end{definition} %where \meta{filename} is the name of the file. %(Any percent symbols \verb|%| contained in the URI will have %their category code set to 12.) % %The canonical path of a file %(\shortarg{p} or \longarg{path}) can be obtained using: %\begin{definition} %\ics{TeXOSQueryFilePath}\marg{cs}\marg{filename} %\end{definition} %where \meta{filename} is the name of the file. % %The canonical path of a file's parent %(\shortarg{e} or \longarg{dirname}) can be obtained using: %\begin{definition} %\ics{TeXOSQueryDirName}\marg{cs}\marg{filename} %\end{definition} %where \meta{filename} is the name of the file. % %The list of files in a given directory %(\shortarg{i} or \longarg{list}) can be obtained using: %\begin{definition} %\ics{TeXOSQueryFileList}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %where \meta{sep} is the separator and \meta{dir} is the directory name. %For example: %\begin{verbatim} %\TeXOSQueryFileList{\result}{,}{.} %\end{verbatim} %will store a comma-separated list of all the files contained in the %current directory in the control sequence \cs{result}. % %To omit directories (\shortarg{ir} or \longarg{list-regular}): %\begin{definition} %\ics{TeXOSQueryRegularFileList}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %To omit regular files (\shortarg{id} or \longarg{list-dir}): %\begin{definition} %\ics{TeXOSQuerySubDirList}\marg{cs}\marg{sep}\marg{dir} %\end{definition} % %A filtered list of files in a given directory %(\shortarg{f} or \longarg{filterlist}) can be obtained using: %\begin{definition} %\ics{TeXOSQueryFilterFileList}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %where \meta{regex} is a regular expression. \emph{Take care of any backslashes %in the regular expression!} %For example, to list only those files that have an extension: %\begin{verbatim} %\TeXOSQueryFilterFileList{\result}{,}{.+\string\..*}{.} %\end{verbatim} %Note the use of \verb|\string\.| to ensure that \cs{.} isn't %interpreted as a command. Another example, list only \file{.png} %and \file{.jpg} files in the directory called \file{images}: %\begin{verbatim} %\TeXOSQueryFilterFileList{\result}{,}{.+\string\.(jpg|png)}{images} %\end{verbatim} % %\begin{important} %Unlike most of the return values the \meta{sep} part here isn't %escaped, so take care if \meta{sep} contains any commands. For %example, if you want to use \verb|\\| as the separator, you'll need %to use \verb|\string\noexpand\string\\| in the \meta{sep} part. %\begin{verbatim} %\TeXOSQueryFilterFileList{\result}{\string\noexpand\string\\}{.*\string\.tex}{.} %\end{verbatim} %\end{important} % %If you want the list sorted, you can use the following which set %the optional \meta{sort} argument. % %Order by last modified date starting with the oldest (\texttt{date-ascending}): %\begin{definition} %\ics{TeXOSQueryFileListDateAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the regular files only list: %\begin{definition} %\ics{TeXOSQueryRegularFileListDateAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the sub-directories only list: %\begin{definition} %\ics{TeXOSQuerySubDirListDateAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or for the filtered list: %\begin{definition} %\ics{TeXOSQueryFilterFileListDateAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or for the filtered regular files only list: %\begin{definition} %\ics{TeXOSQueryFilterRegularFileListDateAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or for the filtered sub-directories only list: %\begin{definition} %\ics{TeXOSQueryFilterSubDirListDateAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %Order by last modified date starting with the newest (\texttt{date-descending}): %\begin{definition} %\ics{TeXOSQueryFileListDateDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the regular files only list: %\begin{definition} %\ics{TeXOSQueryRegularFileListDateDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the sub-directories only list: %\begin{definition} %\ics{TeXOSQuerySubDirListDateDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or for the filtered list: %\begin{definition} %\ics{TeXOSQueryFilterFileListDateDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered regular files only list: %\begin{definition} %\ics{TeXOSQueryFilterRegularFileListDateDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered sub-directories only list: %\begin{definition} %\ics{TeXOSQueryFilterRegularFileListDateDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %Order by file size starting with the smallest (\texttt{size-ascending}): %\begin{definition} %\ics{TeXOSQueryFileListSizeAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the regular files only list: %\begin{definition} %\ics{TeXOSQueryRegularFileListSizeAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the sub-directories only list: %\begin{definition} %\ics{TeXOSQuerySubDirListSizeAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or for the filtered list: %\begin{definition} %\ics{TeXOSQueryFilterFileListSizeAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered regular files only list: %\begin{definition} %\ics{TeXOSQueryFilterRegularFileListSizeAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered sub-directories only list: %\begin{definition} %\ics{TeXOSQueryFilterSubDirListSizeAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %Order by file size starting with the largest (\texttt{size-descending}): %\begin{definition} %\ics{TeXOSQueryFileListSizeDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the regular files only list: %\begin{definition} %\ics{TeXOSQueryRegularFileListSizeDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the sub-directories only list: %\begin{definition} %\ics{TeXOSQuerySubDirListSizeDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or for the filtered list: %\begin{definition} %\ics{TeXOSQueryFilterFileListSizeDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the filtered regular files only list: %\begin{definition} %\ics{TeXOSQueryFilterRegularFileListSizeDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the filtered sub-directories only list: %\begin{definition} %\ics{TeXOSQueryFilterSubDirListSizeDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} % %Order by file name in alphabetical order (\texttt{name-ascending}): %\begin{definition} %\ics{TeXOSQueryFileListNameAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the regular files only list: %\begin{definition} %\ics{TeXOSQueryRegularFileListNameAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the sub-directories only list: %\begin{definition} %\ics{TeXOSQuerySubDirListNameAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or for the filtered list: %\begin{definition} %\ics{TeXOSQueryFilterFileListNameAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered regular files only list: %\begin{definition} %\ics{TeXOSQueryFilterRegularFileListNameAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered sub-directories only list: %\begin{definition} %\ics{TeXOSQueryFilterSubDirListNameAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %Order by file name in reverse alphabetical order (\texttt{name-descending}): %\begin{definition} %\ics{TeXOSQueryFileListNameDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the regular files only list: %\begin{definition} %\ics{TeXOSQueryRegularFileListNameDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the sub-directories only list: %\begin{definition} %\ics{TeXOSQuerySubDirListNameDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or for the filtered list: %\begin{definition} %\ics{TeXOSQueryFilterFileListNameDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the filtered regular files only list: %\begin{definition} %\ics{TeXOSQueryFilterRegularFileListNameDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the filtered sub-directories only list: %\begin{definition} %\ics{TeXOSQueryFilterSubDirListNameDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} % %Order by file name in case-insensitive alphabetical order %(\texttt{iname-ascending}): %\begin{definition} %\ics{TeXOSQueryFileListNameIgnoreCaseAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the regular files only list: %\begin{definition} %\ics{TeXOSQueryRegularFileListNameIgnoreCaseAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the sub-directories only list: %\begin{definition} %\ics{TeXOSQuerySubDirListNameIgnoreCaseAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or for the filtered list: %\begin{definition} %\ics{TeXOSQueryFilterFileListNameIgnoreCaseAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered regular files only list: %\begin{definition} %\ics{TeXOSQueryFilterRegularFileListNameIgnoreCaseAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered sub-directories only list: %\begin{definition} %\ics{TeXOSQueryFilterSubDirListNameIgnoreCaseAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %Order by file name in reverse case-insensitive alphabetical order %(\texttt{iname-descending}): %\begin{definition} %\ics{TeXOSQueryFileListNameIgnoreCaseDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the regular files only list: %\begin{definition} %\ics{TeXOSQueryRegularFileListNameIgnoreCaseDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the sub-directories only list: %\begin{definition} %\ics{TeXOSQuerySubDirListNameIgnoreCaseDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or for the filtered list: %\begin{definition} %\ics{TeXOSQueryFilterFileListNameIgnoreCaseDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered regular files only list: %\begin{definition} %\ics{TeXOSQueryFilterRegularFileListNameIgnoreCaseDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered sub-directories only list: %\begin{definition} %\ics{TeXOSQueryFilterSubDirListNameIgnoreCaseDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %Order by file extension in alphabetical order (\texttt{ext-ascending}): %\begin{definition} %\ics{TeXOSQueryFileListExtAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the regular files only list: %\begin{definition} %\ics{TeXOSQueryRegularFileListExtAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the sub-directories only list: %\begin{definition} %\ics{TeXOSQuerySubDirListExtAsc}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or for the filtered list: %\begin{definition} %\ics{TeXOSQueryFilterFileListExtAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered regular files only list: %\begin{definition} %\ics{TeXOSQueryFilterRegularFileListExtAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered sub-directories only list: %\begin{definition} %\ics{TeXOSQueryFilterSubDirListExtAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %Order by file extension in reverse alphabetical order (\texttt{ext-descending}): %\begin{definition} %\ics{TeXOSQueryFileListExtDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the regular files only list: %\begin{definition} %\ics{TeXOSQueryRegularFileListExtDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or the sub-directories only list: %\begin{definition} %\ics{TeXOSQuerySubDirListExtDes}\marg{cs}\marg{sep}\marg{dir} %\end{definition} %or for the filtered list: %\begin{definition} %\ics{TeXOSQueryFilterFileListExtDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered regular files only list: %\begin{definition} %\ics{TeXOSQueryFilterRegularFileListExtDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or the filtered sub-directories only list: %\begin{definition} %\ics{TeXOSQueryFilterSubDirListExtDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %A recursive filtered list of regular files starting from a given directory %on the current working path %(\shortarg{w} or \longarg{alk}) can be obtained using: %\begin{definition} %\ics{TeXOSQueryWalk}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %where \meta{regex} is as for the filtered listings described above. % %To sort according to last modified date: %\begin{definition} %\ics{TeXOSQueryWalkDateAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or in reverse order: %\begin{definition} %\ics{TeXOSQueryWalkDateDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %To sort according to file size: %\begin{definition} %\ics{TeXOSQueryWalkSizeAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or in reverse order: %\begin{definition} %\ics{TeXOSQueryWalkSizeDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %To sort according to path name (case-sensitive): %\begin{definition} %\ics{TeXOSQueryWalkNameAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or in reverse order: %\begin{definition} %\ics{TeXOSQueryWalkNameDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %To sort according to path name (case-insensitive): %\begin{definition} %\ics{TeXOSQueryWalkNameIgnoreCaseAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or in reverse order: %\begin{definition} %\ics{TeXOSQueryWalkNameIgnoreCaseDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %To sort according to file extension: %\begin{definition} %\ics{TeXOSQueryWalkExtAsc}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} %or in reverse order: %\begin{definition} %\ics{TeXOSQueryWalkExtDes}\marg{cs}\marg{sep}\marg{regex}\marg{dir} %\end{definition} % %\setcounter{secnumdepth}{3} %\StopEventually{\clearpage\printabbreviations %\clearpage\phantomsection %\addcontentsline{toc}{section}{Change History}% %\PrintChanges %\PrintIndex %} % %\section{The Code} %\changes{1.0}{2016-07-08}{Initial release} %\subsection{Generic \TeX\ Code} %\iffalse % \begin{macrocode} %<*texosquery.tex> % \end{macrocode} %\fi %Change category code of \texttt{@} if necessary. % \begin{macrocode} \ifnum\catcode`\@=11\relax \def\@texosquery@restore@at{}% \else \expandafter\edef\csname @texosquery@restore@at\endcsname{% \noexpand\catcode`\noexpand\@=\number\catcode`\@\relax }% \catcode`\@=11\relax \fi % \end{macrocode} % Check if already loaded. % \begin{macrocode} \ifx\TeXOSQuery\undefined \else \@texosquery@restore@at \expandafter\endinput \fi % \end{macrocode} % Version info. % \begin{macrocode} \expandafter\def\csname ver@texosquery.tex\endcsname{2020/02/04 v1.7 (NLCT)} % \end{macrocode} % %\begin{macro}{\@texosquery@warn} %\changes{1.2}{2017-03-23}{added check for tracklang's warning command} %Generate warning message. Use \sty{tracklang}'s warning if %available (so that the warnings can be disabled for both packages %at the same time). % \begin{macrocode} \ifx\@tracklang@pkgwarn\undefined \ifx\PackageWarning\undefined \def\@texosquery@warn#1{% {% \newlinechar=`\^^J \def\MessageBreak{^^J}% \message{^^Jtexosquery Warning: #1 on line \the\inputlineno.^^J}% }% } \else \def\@texosquery@warn#1{% \PackageWarning{texosquery}{#1}% } \fi \else \def\@texosquery@warn#1{% \@tracklang@pkgwarn{texosquery}{#1}% } \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@info} %\changes{1.4}{??}{new} % \begin{macrocode} \ifx\PackageInfo\undefined \def\@texosquery@info#1{% {% \newlinechar=`\^^J \def\MessageBreak{^^J}% \message{^^Jtexosquery Info: #1^^J}% }% } \else \def\@texosquery@info#1{% \PackageInfo{texosquery}{#1}% } \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@err} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\PackageError\undefined \def\@texosquery@err#1#2{% \errhelp{#2}% \errmessage{texosquery: #1}} \else \def\@texosquery@err#1#2{\PackageError{texosquery}{#1}{#2}} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@ifundef} %This is defined in the same way as \sty{tracklang}'s %\cs{@tracklang@ifundef}. (Can't assume \sty{tracklang} has been %loaded.) % \begin{macrocode} \long\def\@texosquery@ifundef#1#2#3{% \ifcsname#1\endcsname \expandafter\ifx\csname #1\endcsname\relax #2% \else #3% \fi \else \expandafter\ifx\csname #1\endcsname\relax #2% \else #3% \fi \fi } \ifx\ifcsname\undefined \long\def\@texosquery@ifundef#1#2#3{% \expandafter\ifx\csname #1\endcsname\relax #2% \else #3% \fi } \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSInvokerName} %The name of the \app{texosquery} application. % \begin{macrocode} \def\TeXOSInvokerName{texosquery} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquery@input} %\changes{1.4}{2017-05-05}{new} %If we're using \LaTeX, we'll need to use \cs{@@input} rather %than \cs{input}. % \begin{macrocode} \ifx\@@input\undefined \let\texosquery@input\input \else \let\texosquery@input\@@input \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryInvoker} %Invoke the application in the piped shell escape with the given %arguments. % \begin{macrocode} \def\TeXOSQueryInvoker#1{\texosquery@input|"\TeXOSInvokerName\space#1" } % \end{macrocode} %\end{macro} % %\begin{macro}{\ifTeXOSQueryDryRun} %Provide a dry-run mode. %\changes{1.1}{2016-07-14}{dry run mode only false by default if %used in unrestricted mode} % \begin{macrocode} \newif\ifTeXOSQueryDryRun \TeXOSQueryDryRuntrue % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryAllowRestricted} %\changes{1.2}{2017-03-23}{new} %The default behaviour only switches off the dry-run mode if the %shell escape is unrestricted. The configuration file may override %this with \cs{TeXOSQueryAllowRestricted}, which will allow %the dry run mode to be switched off if restricted mode is detected. % \begin{macrocode} \def\TeXOSQueryAllowRestricted{% \def\@texosquery@allowrestricted##1##2{##1}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryDenyRestricted} %\changes{1.2}{2017-03-23}{new} %Switch it off. % \begin{macrocode} \def\TeXOSQueryDenyRestricted{% \def\@texosquery@allowrestricted##1##2{##2}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@allowrestricted} %\changes{1.2}{2017-03-23}{new} %Initialise to prevent shell escape in restricted mode. % \begin{macrocode} \def\@texosquery@allowrestricted#1#2{#2}% % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSInvokerRestrictedMessage} %\changes{1.4}{2017-05-05}{new} %Message used if \TeX\ is run in restricted mode but the invoker %name hasn't been allowed. This may be redefined in the %configuration file to customise the message if the invoker name %isn't allowed. Set to empty or \cs{relax} if the message should be %omitted. % \begin{macrocode} \def\TeXOSInvokerRestrictedMessage{% \string\TeXOSQuery\space doesn't work in dry run mode. \MessageBreak If `\TeXOSInvokerName' has been added to the \MessageBreak restricted list, make sure that \MessageBreak \string\TeXOSQueryAllowRestricted\space \MessageBreak has been uncommented in the configuration file \MessageBreak (texosquery.cfg) otherwise you need to use the \MessageBreak unrestricted shell escape} % \end{macrocode} %\end{macro} %Only need to write this information to the transcript if %\cs{TeXOSQuery} is actually used and the dry run mode is on in %restricted mode. %\begin{macro}{\@texosquery@dorestrictedmessage} % \begin{macrocode} \let\@texosquery@dorestrictedmessage\relax % \end{macrocode} %\end{macro} % %Load the configuration file if it exists. %\changes{1.2}{2017-03-23}{added texosquery.cfg} % \begin{macrocode} \openin0=texosquery.cfg \ifeof0\relax \else \closein0\relax \begingroup \@texosquery@info{reading configuration file}% \endgroup \input texosquery.cfg \fi % \end{macrocode} %Disable cfg-only commands: % \begin{macrocode} \def\TeXOSQueryAllowRestricted{% \@texosquery@warn{\string\TeXOSQueryAllowRestricted\space ignored (only allowed in texosquery.cfg)}% } \def\TeXOSQueryDenyRestricted{% \@texosquery@warn{\string\TeXOSQueryDenyRestricted\space ignored (only allowed in texosquery.cfg)}% } % \end{macrocode} % %\begin{macro}{\texosquery@shellescape} %\changes{1.4}{2017-05-05}{new} %We need to know the shell escape mode. This is provided by %PDF\TeX's \cs{pdfshellescape} primitive or \XeTeX's %\cs{shellescape} primitive. It's a little more complicated in %Lua\TeX. Initialise to 0: % \begin{macrocode} \chardef\texosquery@shellescape=0 % \end{macrocode} % Test for the PDF\TeX\ and \XeTeX\ primitives. % \begin{macrocode} \ifx\shellescape\undefined \ifx\pdfshellescape\undefined % \end{macrocode} %Neither primitive defined. Has \sty{pdftexcmds} been loaded? If so, %we can use \cs{pdf@shellescape}. % \begin{macrocode} \ifx\pdf@shellescape\undefined % \end{macrocode} %\cs{pdf@shellescape} hasn't been defined. Is Lua\TeX\ in use? % \begin{macrocode} \ifx\directlua\undefined % \end{macrocode} %Not Lua\TeX. Most likely an old \TeX\ format. Have to assume the %shell escape is unavailable. % \begin{macrocode} \else % \end{macrocode} %Use Lua to find the shell escape. This uses the same method as %\sty{pdftexcmds}. (Not loading that package, as this is the only %thing required from it.) % \begin{macrocode} \edef\texosquery@shellescape{\directlua0{ if os.execute then if status and status.luatex_version and status.luatex_version >= 68 then tex.write(os.execute()) else local result = os.execute() if result == 0 then tex.write("0") else if result == nil then tex.write("0") else tex.write("1") end end end else tex.write("0") end }} \fi \else \let\texosquery@shellescape\pdf@shellescape \fi \else % \end{macrocode} %PDF\TeX's \cs{pdfshellescape} has been defined, so that can be %used, but first check it hasn't been set to \cs{relax}. % \begin{macrocode} \ifx\pdfshellescape\relax % \end{macrocode} %Something's meddled with \cs{pdfshellescape}, so try %\cs{pdf@shellescape}. % \begin{macrocode} \ifx\pdf@shellescape\undefined % \end{macrocode} %\cs{pdf@shellescape} hasn't been defined. Is Lua\TeX\ in use? % \begin{macrocode} \ifx\directlua\undefined % \end{macrocode} %Not Lua\TeX. Most likely an old \TeX\ format. Have to assume the %shell escape is unavailable. % \begin{macrocode} \else % \end{macrocode} %Use Lua to find the shell escape. % \begin{macrocode} \edef\texosquery@shellescape{\directlua0{ if os.execute then if status and status.luatex_version and status.luatex_version >= 68 then tex.write(os.execute()) else local result = os.execute() if result == 0 then tex.write("0") else if result == nil then tex.write("0") else tex.write("1") end end end else tex.write("0") end }} \fi \else \let\texosquery@shellescape\pdf@shellescape \fi \else \let\texosquery@shellescape\pdfshellescape \fi \fi \else % \end{macrocode} %\XeTeX's \cs{shellescape} has been defined, so that can be used, %but first check it hasn't been set to \cs{relax}. % \begin{macrocode} \ifx\shellescape\relax % \end{macrocode} %Something's meddled with \cs{shellescape}, so try %\cs{pdfshellescape}. % \begin{macrocode} \ifx\pdfshellescape\undefined \else % \end{macrocode} %\cs{pdfshellescape} has been defined, so that can be used, but %first check it hasn't been set to \cs{relax}. % \begin{macrocode} \ifx\pdfshellescape\relax % \end{macrocode} %Something's meddled with \cs{pdfshellescape}, so try %\cs{pdf@shellescape}. % \begin{macrocode} \ifx\pdf@shellescape\undefined % \end{macrocode} %Try Lua. % \begin{macrocode} \ifx\directlua\undefined % \end{macrocode} %Not Lua\TeX. Most likely an old \TeX\ format. Have to assume the %shell escape is unavailable. % \begin{macrocode} \else % \end{macrocode} %Use Lua to find the shell escape. % \begin{macrocode} \edef\texosquery@shellescape{\directlua0{ if os.execute then if status and status.luatex_version and status.luatex_version >= 68 then tex.write(os.execute()) else local result = os.execute() if result == 0 then tex.write("0") else if result == nil then tex.write("0") else tex.write("1") end end end else tex.write("0") end }} \fi \else \let\texosquery@shellescape\pdf@shellescape \fi \else \let\texosquery@shellescape\pdfshellescape \fi \fi \else \let\texosquery@shellescape\shellescape \fi \fi % \end{macrocode} %\end{macro} % %If shell escape is unrestricted, automatically switch off dry-run %mode, unless the cfg file has allowed it. % \begin{macrocode} \ifcase\texosquery@shellescape \@texosquery@info{shell escape disabled, dry-run mode on} \or \TeXOSQueryDryRunfalse \or \@texosquery@allowrestricted {% \TeXOSQueryDryRunfalse } {% \@texosquery@info{shell escape restricted, dry-run mode on.} % \end{macrocode} %Enable the restricted warning message, but it only needs to be %written once, so disable it after use. % \begin{macrocode} \def\@texosquery@dorestrictedmessage{% \ifx\TeXOSInvokerRestrictedMessage\empty \else \ifx\TeXOSInvokerRestrictedMessage\relax \else \@texosquery@warn{\TeXOSInvokerRestrictedMessage}% \fi \fi \let\@texosquery@dorestrictedmessage\relax } } \fi % \end{macrocode} % %\begin{macro}{\@texosquery@edef} %Need to provide some protection (if available) against non-ASCII characters %that have been made active by \sty{inputenc} when reading in the %results of the shell escape. This command may be defined before loading %\sty{texosquery}, otherwise it's set to \cs{protected@edef}, if %defined, or \cs{edef}. %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\@texosquery@edef\undefined \ifx\protected@edef\undefined \let\@texosquery@edef\edef \else \let\@texosquery@edef\protected@edef \fi \fi % \end{macrocode} %\end{macro} % %Provide some utility commands. (Can't use \cs{@gobble} etc, as we %may not be using \LaTeX.) %\begin{macro}{\@texosquery@gobble} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@gobble#1{} % \end{macrocode} %\end{macro} %\begin{macro}{\@texosquery@firstofone} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@firstofone#1{#1} % \end{macrocode} %\end{macro} % %The results obtained from \app{texosquery} may be file names for %use in commands like \cs{input} or \cs{includegraphics} or they may %be text that needs typesetting (such as month names) or they may be %date-time patterns or numeric patterns or they may be PDF date-time %strings, which may need to have the category code of the initial %\qt{D} set to 12 for parsing commands that include this character %in the argument syntax. % %This means that we need to take special characters into account, %but the way they are dealt with vary according to context. For %example, \verb|#| needs to have the category code set to 12 if it's %part of a file name. If an image file is called, say, %\verb|test_imagefile#.png| then the following doesn't work: %\begin{verbatim} %\includegraphics{test\_imagefile\#} %\end{verbatim} %It needs to be %\begin{verbatim} %\includegraphics{test\string_imagefile\string#} %\end{verbatim} %or %\begin{verbatim} %\includegraphics{\detokenize{test_imagefile#}} %\end{verbatim} %The first two versions of \sty{texosquery} try to deal with this by %simply changing the category code of \verb|_| to 12 and getting %\app{texosquery} to replace all instances of \verb|#| with %\verb|\#|. This hash substitution doesn't work with the above image %example so version 1.2 introduced a new command that %\app{texosquery} could use instead of \verb|\#| that expands to %\verb|\string#|. This now solves the problem for file names that %are obtained through \app{texosquery}, but \app{texosquery} doesn't %solely return file names. It also returns text that needs %typesetting and it also returns numeric patterns, which in their %raw form include \verb|#| as a digit identifier. % %This means that we can't simply detokenize the result from %\app{texosquery}. Instead \app{texosquery} replaces problematic %characters with control sequences \emph{according to context}. %For example, \cs{texosqueryhash} is used in a file name context, %\cs{texosquerytexthash} is used in a textual context and %\cs{texosquerypatdigitnozero} in a numeric pattern context. % %These long control sequence names clutter the results when testing %the application directly in a terminal, so the Java code uses short %forms that are locally defined by \cs{TeXOSQuery} to expand to the %longer forms. % %\begin{macro}{\texosquerynonasciiwrap} %\changes{1.2}{2017-03-23}{new} %Allow a way to deal with non-ASCII characters returned by %\app{texosquery}. \cs{TeXOSQuery} locally defines \cs{twrp} %to this command. By default this just does its argument %but may be redefined. For example, if the document uses a different %file encoding to Java, then this command might need to be redefined %to perform the appropriate conversion. % \begin{macrocode} \def\texosquerynonasciiwrap#1{#1} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerynonasciidetokwrap} %\changes{1.2}{2017-03-23}{new} %We also need to allow for non-ASCII characters in file names. In %this case the argument needs detokenizing. With \eTeX, we can %simply use \cs{detokenize} but we need to allow for plain %non-extended \TeX, so check for the existence of \cs{detokenize} %first. % \begin{macrocode} \ifx\detokenize\undefined % \end{macrocode} %This won't work for characters consisting of multiple octets, %but if users want UTF-8 support then they really need \eTeX\ at the %very least (but ideally \XeTeX\ or \LuaTeX). % \begin{macrocode} \def\texosquerynonasciidetokwrap#1{\string#1} \else \def\texosquerynonasciidetokwrap#1{\detokenize{#1}} \fi % \end{macrocode} %\end{macro} % %Now define commands used in \cs{TeXOSQuery} for various escaped characters. %The literal versions are for file names. The textual versions are %for use within the document text. For completeness, all the ASCII %punctuation characters have both a literal and textual version. %This helps to protect against \sty{babel} shorthands etc. % %\begin{macro}{\texosquerybackslash} %\changes{1.2}{2017-03-23}{new} %Literal backslash. % \begin{macrocode} \edef\texosquerybackslash{\expandafter\@texosquery@gobble\string\\} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextbackslash} %\changes{1.2}{2017-03-23}{new} %Textual backslash. % \begin{macrocode} \ifx\textbackslash\undefined \def\texosquerytextbackslash{\texosquerybackslash} \else \def\texosquerytextbackslash{\noexpand\textbackslash} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryleftbrace} %\changes{1.2}{2017-03-23}{new} %Literal left brace. % \begin{macrocode} \edef\texosqueryleftbrace{\expandafter\@texosquery@gobble\string\{} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextleftbrace} %\changes{1.2}{2017-03-23}{new} %Textual left brace. % \begin{macrocode} \def\texosquerytextleftbrace{\{} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryrightbrace} %\changes{1.2}{2017-03-23}{new} %Literal right brace. % \begin{macrocode} \edef\texosqueryrightbrace{\expandafter\@texosquery@gobble\string\}} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextrightbrace} %\changes{1.2}{2017-03-23}{new} %Textual right brace. % \begin{macrocode} \def\texosquerytextrightbrace{\}} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryhash} %\changes{1.2}{2017-03-23}{new} %Literal hash. % \begin{macrocode} \edef\texosqueryhash{\expandafter\@texosquery@gobble\string\#} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytexthash} %\changes{1.2}{2017-03-23}{new} %Textual hash. % \begin{macrocode} \def\texosquerytexthash{\#} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryunderscore} %\changes{1.2}{2017-03-23}{new} %Literal underscore. % \begin{macrocode} \edef\texosqueryunderscore{\expandafter\@texosquery@gobble\string\_} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextunderscore} %\changes{1.2}{2017-03-23}{new} %Textual underscore. % \begin{macrocode} \def\texosquerytextunderscore{\_} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerybacktick} %\changes{1.2}{2017-03-23}{new} %Literal grave. % \begin{macrocode} \edef\texosquerybacktick{\string`} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextbacktick} %\changes{1.2}{2017-03-23}{new} %Textual open quote. % \begin{macrocode} \def\texosquerytextbacktick{`} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryclosequote} %\changes{1.2}{2017-03-23}{new} %Literal apostrophe. % \begin{macrocode} \edef\texosqueryclosequote{\string'} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextclosequote} %\changes{1.2}{2017-03-23}{new} %Textual apostrophe / single closing quote. % \begin{macrocode} \def\texosquerytextclosequote{'} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerydoublequote} %\changes{1.2}{2017-03-23}{new} %Literal double-quote. % \begin{macrocode} \edef\texosquerydoublequote{\string"} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextdoublequote} %\changes{1.2}{2017-03-23}{new} %Textual double-quote. % \begin{macrocode} \def\texosquerytextdoublequote{"} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycolon} %\changes{1.2}{2017-03-23}{new} %Literal colon. % \begin{macrocode} \edef\texosquerycolon{\string:} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextcolon} %\changes{1.2}{2017-03-23}{new} %Textual colon. % \begin{macrocode} \def\texosquerytextcolon{:} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerysemicolon} %\changes{1.2}{2017-03-23}{new} %Literal semi-colon. % \begin{macrocode} \edef\texosquerysemicolon{\string;} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextsemicolon} %\changes{1.2}{2017-03-23}{new} %Textual semi-colon. % \begin{macrocode} \def\texosquerytextsemicolon{;} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryequals} %\changes{1.2}{2017-03-23}{new} %Literal equals. % \begin{macrocode} \edef\texosqueryequals{\string=} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextequals} %\changes{1.2}{2017-03-23}{new} %Textual equals. % \begin{macrocode} \def\texosquerytextequals{=} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryslash} %\changes{1.2}{2017-03-23}{new} %Literal slash. % \begin{macrocode} \edef\texosqueryslash{\string/} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextslash} %\changes{1.2}{2017-03-23}{new} %Textual slash. % \begin{macrocode} \def\texosquerytextslash{/} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryhyphen} %\changes{1.2}{2017-03-23}{new} %Literal hyphen. % \begin{macrocode} \edef\texosqueryhyphen{\string-} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytexthyphen} %\changes{1.2}{2017-03-23}{new} %Textual hyphen. % \begin{macrocode} \def\texosquerytexthyphen{-} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryplus} %\changes{1.2}{2017-03-23}{new} %Literal plus. % \begin{macrocode} \edef\texosqueryplus{\string+} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextplus} %\changes{1.2}{2017-03-23}{new} %Textual plus. % \begin{macrocode} \def\texosquerytextplus{+} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryperiod} %\changes{1.2}{2017-03-23}{new} %Literal period. % \begin{macrocode} \edef\texosqueryperiod{\string.} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextperiod} %\changes{1.2}{2017-03-23}{new} %Textual period. % \begin{macrocode} \def\texosquerytextperiod{.} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycomma} %\changes{1.2}{2017-03-23}{new} %Literal comma. % \begin{macrocode} \edef\texosquerycomma{\string,} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextcomma} %\changes{1.2}{2017-03-23}{new} %Textual comma. % \begin{macrocode} \def\texosquerytextcomma{,} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryopenparen} %\changes{1.2}{2017-03-23}{new} %Literal open bracket. % \begin{macrocode} \edef\texosqueryopenparen{\string(} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextopenparen} %\changes{1.2}{2017-03-23}{new} %Textual open bracket. % \begin{macrocode} \def\texosquerytextopenparen{(} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycloseparen} %\changes{1.2}{2017-03-23}{new} %Literal close bracket. % \begin{macrocode} \edef\texosquerycloseparen{\string)} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextcloseparen} %\changes{1.2}{2017-03-23}{new} %Textual close bracket. % \begin{macrocode} \def\texosquerytextcloseparen{)} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryopensq} %\changes{1.2}{2017-03-23}{new} %Literal open square bracket. % \begin{macrocode} \edef\texosqueryopensq{\string[} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextopensq} %\changes{1.2}{2017-03-23}{new} %Textual open square bracket. % \begin{macrocode} \def\texosquerytextopensq{[} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryclosesq} %\changes{1.2}{2017-03-23}{new} %Literal close square bracket. % \begin{macrocode} \edef\texosqueryclosesq{\string]} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextclosesq} %\changes{1.2}{2017-03-23}{new} %Textual close square bracket. % \begin{macrocode} \def\texosquerytextclosesq{]} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryasterisk} %\changes{1.2}{2017-03-23}{new} %Literal asterisk. % \begin{macrocode} \edef\texosqueryasterisk{\string*} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextasterisk} %\changes{1.2}{2017-03-23}{new} %Textual asterisk. % \begin{macrocode} \def\texosquerytextasterisk{*} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryatchar} %\changes{1.2}{2017-03-23}{new} %Literal at character. % \begin{macrocode} \edef\texosqueryatchar{\string @} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextatchar} %\changes{1.2}{2017-03-23}{new} %Textual at character. % \begin{macrocode} \def\texosquerytextatchar{@} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerybar} %\changes{1.2}{2017-03-23}{new} %Literal bar. % \begin{macrocode} \edef\texosquerybar{\string|} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextbar} %\changes{1.2}{2017-03-23}{new} %Textual bar. % \begin{macrocode} \ifx\undefined\textbar \def\texosquerytextbar{|} \else \def\texosquerytextbar{\ifmmode|\else\textbar\fi} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerylessthan} %\changes{1.2}{2017-03-23}{new} %Literal less than. % \begin{macrocode} \edef\texosquerylessthan{\string<} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextlessthan} %\changes{1.2}{2017-03-23}{new} %Textual less than. % \begin{macrocode} \ifx\undefined\textless \def\texosquerytextlessthan{<} \else \def\texosquerytextlessthan{\ifmmode<\else\textless\fi} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerygreaterthan} %\changes{1.2}{2017-03-23}{new} %Literal greater than. % \begin{macrocode} \edef\texosquerygreaterthan{\string>} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextgreaterthan} %\changes{1.2}{2017-03-23}{new} %Textual greater than. % \begin{macrocode} \ifx\undefined\textgreater \def\texosquerytextgreaterthan{>} \else \def\texosquerytextgreaterthan{\ifmmode<\else\textgreater\fi} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytilde} %\changes{1.2}{2017-03-23}{new} %Literal tilde. % \begin{macrocode} \edef\texosquerytilde{\string~} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytexttilde} %\changes{1.2}{2017-03-23}{new} %Textual tilde. % \begin{macrocode} \ifx\textasciitilde\undefined \def\texosquerytexttilde{\string~} \else \def\texosquerytexttilde{\textasciitilde} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycircum} %\changes{1.2}{2017-03-23}{new} %Literal circumflex. % \begin{macrocode} \edef\texosquerycircum{\string^} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextcircum} %\changes{1.2}{2017-03-23}{new} %Textual circumflex. % \begin{macrocode} \ifx\textasciicircum\undefined \def\texosquerytextcircum{\string^} \else \def\texosquerytextcircum{\textasciicircum} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryampersand} %\changes{1.2}{2017-03-23}{new} %Literal ampersand. % \begin{macrocode} \edef\texosqueryampersand{\string&} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextampersand} %\changes{1.2}{2017-03-23}{new} %Textual ampersand. % \begin{macrocode} \def\texosquerytextampersand{\&} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerydollar} %\changes{1.2}{2017-03-23}{new} %Literal dollar. (This could just be defined as \verb|\string$|, but %that plays havoc with the syntax highlighting!) % \begin{macrocode} \edef\texosquerydollar{\expandafter\@texosquery@gobble\string\$} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextdollar} %\changes{1.2}{2017-03-23}{new} %Textual dollar. % \begin{macrocode} \def\texosquerytextdollar{\$} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerypercent} %\changes{1.2}{2017-03-23}{new} %Literal percent. % \begin{macrocode} \edef\texosquerypercent{\expandafter\@texosquery@gobble\string\%} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextpercent} %\changes{1.2}{2017-03-23}{new} %Textual percent. % \begin{macrocode} \def\texosquerytextpercent{\%} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryexclam} %\changes{1.2}{2017-03-23}{new} %Literal exclamation. % \begin{macrocode} \edef\texosqueryexclam{\string!} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextexclam} %\changes{1.2}{2017-03-23}{new} %Textual exclamation. % \begin{macrocode} \def\texosquerytextexclam{!} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryquestion} %\changes{1.2}{2017-03-23}{new} %Literal question mark. % \begin{macrocode} \edef\texosqueryquestion{\string?} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextquestion} %\changes{1.2}{2017-03-23}{new} %Textual question mark. % \begin{macrocode} \def\texosquerytextquestion{?} % \end{macrocode} %\end{macro} % % %\begin{macro}{\texosqueryliteralspace} %\changes{1.2}{2017-03-23}{new} %Literal space. % \begin{macrocode} \edef\texosqueryliteralspace{\expandafter\string\space} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytextspace} %\changes{1.2}{2017-03-23}{new} %Textual space. (Don't allow it to expand while it's being fetched %from \cs{texosquery} just in case it disappears.) % \begin{macrocode} \def\texosquerytextspace{\noexpand\space} % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@D} %\changes{1.2}{2017-03-23}{new} %The \verb|D| identifier in PDF date-time formats need to have %category code 12. This is only used by methods that return results %in the form: % %\verb|D:|\meta{YYYY}\meta{MM}\marg{DD}\meta{HH}\meta{mm}\meta{ss}\meta{TZh}\verb|'|\meta{TZm}\verb|'| % \begin{macrocode} \edef\@texosquery@D{\string D} % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@enableshortcs} %\changes{1.2}{2017-03-23}{new} %\hypertarget{enableshortcs}{Enable shortcut commands.} % \begin{macrocode} \def\@texosquery@enableshortcs{% % \end{macrocode} %Thesre are for the date-time and numeric patterns. % \begin{macrocode} \def\patdtf{\noexpand\texosquerydtf}% \def\patpmnumfmt{\noexpand\texosquerypatplusminus}% \def\patnumfmt{\noexpand\texosquerypatnum}% \def\patsinumfmt{\noexpand\texosquerypatsinum}% \def\patdecfmt{\noexpand\texosquerypatdec}% \def\patpcur{\noexpand\texosquerypatprefixcurrency}% \def\patpicur{\noexpand\texosquerypatprefixicurrency}% \def\patscur{\noexpand\texosquerypatsuffixcurrency}% \def\patsicur{\noexpand\texosquerypatsuffixicurrency}% \def\patstr{\noexpand\texosquerypatstr}% \def\patapo{\noexpand\texosquerypatquote}% \def\patdgt{\noexpand\texosquerypatdigit}% \def\patdgtnz{\noexpand\texosquerypatdigitnozero}% \def\patmsg{\noexpand\texosquerypatminus}% \def\patngp{\noexpand\texosquerypatgroupsep}% \def\patppct{\noexpand\texosquerypatprefixpercent}% \def\patspct{\noexpand\texosquerypatsuffixpercent}% \def\patppml{\noexpand\texosquerypatprefixpermill}% \def\patspml{\noexpand\texosquerypatsuffixpermill}% % \end{macrocode} %Hook to adjust the processing of non-ASCII characters. % \begin{macrocode} \def\twrp{\texosquerynonasciiwrap}% \def\fwrp{\texosquerynonasciidetokwrap}% % \end{macrocode} %Locally redefine some more commands that may occur in %\app{texosquery}'s return value (via the \texttt{escapeSpChars} %method in \file{TeXOSQuery.java}). The \texttt{t} prefix indicates %textual commands and the \texttt{f} prefix indicates literal %characters, for example, in file names. % \begin{macrocode} \let\fbks\texosquerybackslash \let\tbks\texosquerytextbackslash \let\flbr\texosqueryleftbrace \let\tlbr\texosquerytextleftbrace \let\frbr\texosqueryrightbrace \let\trbr\texosquerytextrightbrace \let\fhsh\texosqueryhash \let\thsh\texosquerytexthash \let\fusc\texosqueryunderscore \let\tusc\texosquerytextunderscore \let\fgrv\texosquerybacktick \let\tgrv\texosquerytextbacktick \let\fapo\texosqueryclosequote \let\tapo\texosquerytextclosequote \let\fdqt\texosquerydoublequote \let\tdqt\texosquerytextdoublequote \let\fspc\texosqueryliteralspace \let\tspc\texosquerytextspace \let\fcln\texosquerycolon \let\tcln\texosquerytextcolon \let\fscl\texosquerysemicolon \let\tscl\texosquerytextsemicolon \let\feql\texosqueryequals \let\teql\texosquerytextequals \let\fhyn\texosqueryhyphen \let\thyn\texosquerytexthyphen \let\fpls\texosqueryplus \let\tpls\texosquerytextplus \let\ftld\texosquerytilde \let\ttld\texosquerytexttilde \let\fcir\texosquerycircum \let\tcir\texosquerytextcircum \let\famp\texosqueryampersand \let\tamp\texosquerytextampersand \let\fslh\texosqueryslash \let\tslh\texosquerytextslash \let\fpct\texosquerypercent \let\tpct\texosquerytextpercent \let\fexc\texosqueryexclam \let\texc\texosquerytextexclam \let\fque\texosqueryquestion \let\tque\texosquerytextquestion \let\fles\texosquerylessthan \let\tles\texosquerytextlessthan \let\fgre\texosquerygreaterthan \let\tgre\texosquerytextgreaterthan \let\fdol\texosquerydollar \let\tdol\texosquerytextdollar \let\fdot\texosqueryperiod \let\tdot\texosquerytextperiod \let\fcom\texosquerycomma \let\tcom\texosquerytextcomma \let\fopb\texosqueryopenparen \let\topb\texosquerytextopenparen \let\fclb\texosquerycloseparen \let\tclb\texosquerytextcloseparen \let\fosb\texosqueryopensq \let\tosb\texosquerytextopensq \let\fcsb\texosqueryclosesq \let\tcsb\texosquerytextclosesq \let\fast\texosqueryasterisk \let\tast\texosquerytextasterisk \let\fatc\texosqueryatchar \let\tatc\texosquerytextatchar \let\pdfd\@texosquery@D } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQuery} %Use \app{texosquery} with the option given in the second %argument and store the result in control sequence given in the %first argument. % \begin{macrocode} \def\TeXOSQuery#1#2{% \ifTeXOSQueryDryRun \@texosquery@dorestrictedmessage \begingroup \newlinechar=`\^^J \message{^^JTeXOSQuery: \TeXOSInvokerName\space#2^^J}% \endgroup \def#1{}% \else \begingroup \endlinechar=-1\relax % \end{macrocode} %Locally redefine short commands used by \app{texosquery} % \begin{macrocode} \@texosquery@enableshortcs % \end{macrocode} %Change the category code of some potentially awkward characters. %(This should no longer be an issue with the new commands that %are now used in the returned text, but \app{texosquery} might be run with the %backward compatibility mode on, so this is %still needed just in case.) % \begin{macrocode} \catcode`\-=12\relax \catcode`\_=12\relax \catcode`\^=12\relax \catcode`\~=12\relax \catcode`\$=12\relax \catcode`\&=12\relax \catcode`\.=12\relax \catcode`\/=12\relax \catcode`\:=12\relax \catcode`\"=12\relax \catcode`\'=12\relax \catcode`\;=12\relax \catcode`\%=12\relax \everyeof{\noexpand}\relax \@texosquery@edef\@texosquery@tmp{\endgroup\def\noexpand#1{\TeXOSQueryInvoker{#2}}}\@texosquery@tmp \fi } % \end{macrocode} %\changes{1.7}{2020-02-04}{renamed scratch variable} %\end{macro} % %\begin{macro}{\TeXOSQueryFromFile} %\changes{1.4}{2017-05-05}{new} %This is like \cs{TeXOSQuery} but doesn't use the piped shell %escape. Instead, it's for cases where \app{texosquery} is run %before \TeX\ and the results have been captured in a file. For %example, \verb|texosquery -b > texosqueryresult.tex| %The second argument is the file name. % \begin{macrocode} \def\TeXOSQueryFromFile#1#2{% % \end{macrocode} %First check that the file exists. % \begin{macrocode} \openin0=#2 \ifeof0\relax \def#1{}% \else \closein0\relax \begingroup \endlinechar=-1\relax \@texosquery@enableshortcs \catcode`\-=12\relax \catcode`\_=12\relax \catcode`\^=12\relax \catcode`\~=12\relax \catcode`\$=12\relax \catcode`\&=12\relax \catcode`\.=12\relax \catcode`\/=12\relax \catcode`\:=12\relax \catcode`\"=12\relax \catcode`\'=12\relax \catcode`\;=12\relax \catcode`\%=12\relax \everyeof{\noexpand}\relax \@texosquery@edef\@texosquery@tmp{\endgroup\def\noexpand#1{\texosquery@input #2 }}\@texosquery@tmp \fi } % \end{macrocode} %\changes{1.7}{2020-02-04}{renamed scratch variable} %\end{macro} % % %\subsubsection{Currency} %The \meta{\TeX\ currency} element of \longarg{numeric} and %\longarg{locale-data} identifies the currency symbol using %\begin{definition} %\cs{texosquerycurrency}\marg{label} %\end{definition} %which simply expands to the appropriate command. %\begin{macro}{\texosquerycurrency} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrency#1{% \expandafter\noexpand\csname texosquerycurrency#1\endcsname } % \end{macrocode} %\end{macro} % %Provide the currency commands that may be returned %\app{texosquery} (on expansion of \cs{texosquerycurrency}). %Most of these will need redefining as there's no appropriate %generic code to use as a default. %The \sty{fontawesome} package has the most support for currency %symbols, so these are checked first. %\begin{macro}{\texosquerycurrencydollar} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\faDollar\undefined \def\texosquerycurrencydollar{\$} \else \def\texosquerycurrencydollar{\faDollar} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencycent} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\textcent\undefined \def\texosquerycurrencycent{cent} \else \def\texosquerycurrencycent{\textcent} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencypound} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\faGbp\undefined \ifx\pounds\undefined \def\texosquerycurrencypound{pound} \else \def\texosquerycurrencypound{\pounds} \fi \else \def\texosquerycurrencypound{\faGbp} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencysign} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\textcurrency\undefined \def\texosquerycurrencysign{currency-sign} \else \def\texosquerycurrencysign{\textcurrency} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencyyen} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\faYen\undefined \ifx\textyen\undefined \def\texosquerycurrencyyen{yen} \else \def\texosquerycurrencyyen{\textyen} \fi \else \def\texosquerycurrencyyen{\faYen} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencyecu} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencyecu{ecu} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencycolon} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencycolon{colon} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencycruzeiro} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencycruzeiro{cruzeiro} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencyfranc} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencyfranc{franc} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencylira} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\textlira\undefined \def\texosquerycurrencylira{lira} \else \def\texosquerycurrencylira{\textlira} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencymill} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencymill{mill} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencynaira} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\textnaira\undefined \def\texosquerycurrencynaira{naira} \else \def\texosquerycurrencynaira{\textnaira} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencypeseta} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencypeseta{peseta} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencyrupee} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\faRupee\undefined \def\texosquerycurrencyrupee{rupee} \else \def\texosquerycurrencyrupee{\faRupee} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencywon} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\faWon\undefined \ifx\textwon\undefined \def\texosquerycurrencywon{won} \else \def\texosquerycurrencywon{\textwon} \fi \else \def\texosquerycurrencywon{\faWon} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencynewsheqel} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\faSheqel\undefined \def\texosquerycurrencynewsheqel{newsheqel} \else \def\texosquerycurrencynewsheqel{\faSheqel} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencydong} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\textdong\undefined \def\texosquerycurrencydong{dong} \else \def\texosquerycurrencydong{\textdong} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencyeuro} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\faEuro\undefined \ifx\texteuro\undefined \ifx\euro\undefined \def\texosquerycurrencyeuro{euro} \else \def\texosquerycurrencyeuro{\euro} \fi \else \def\texosquerycurrencyeuro{\texteuro} \fi \else \def\texosquerycurrencyeuro{\faEuro} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencykip} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencykip{kip} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencytugrik} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencytugrik{tugrik} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencydrachma} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencydrachma{drachma} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencygermanpenny} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencygermanpenny{german-penny} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencypeso} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\textpeso\undefined \def\texosquerycurrencypeso{peso} \else \def\texosquerycurrencypeso{\textpeso} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencyguarani} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\textguarani\undefined \def\texosquerycurrencyguarani{guarani} \else \def\texosquerycurrencyguarani{\textguarani} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencyaustral} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencyaustral{austral} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencyhryvnia} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencyhryvnia{hryvnia} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencycedi} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\textcolonmonetary\undefined \def\texosquerycurrencycedi{cedi} \else \def\texosquerycurrencycedi{\textcolonmonetary} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencylivretournois} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencylivretournois{livre-tournois} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencyspesmilo} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencyspesmilo{spesmilo} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencytenge} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencytenge{tenge} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencyrupee} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencyrupee{rupee} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencyturkishlira} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\faTurkishLira\undefined \def\texosquerycurrencyturkishlira{turkish-lira} \else \def\texosquerycurrencyturkishlira{\faTurkishLira} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencynordicmark} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencynordicmark{nordic-mark} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencymanat} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerycurrencymanat{manat} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerycurrencyruble} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \ifx\faRuble\undefined \def\texosquerycurrencyruble{ruble} \else \def\texosquerycurrencyruble{\faRuble} \fi % \end{macrocode} %\end{macro} % %\subsubsection{Shortcut Commands} %Now for some convenient shortcuts so the user doesn't have to %remember the command line options. \cs{string} is used in %case the hyphen character has been made active. %\begin{macro}{\TeXOSQueryLocale} %Query the locale and store the result in the control sequence %provided in the argument. % \begin{macrocode} \def\TeXOSQueryLocale#1{\TeXOSQuery{#1}{\string-l}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryLangTag} %Query the language tag and store the result in the control sequence %provided in the argument. %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\TeXOSQueryLangTag#1{\TeXOSQuery{#1}{\string-b}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryNumeric} %Query the numeric settings for the locale given in the second %argument and store the result in the control sequence %provided in the argument. Leave the second argument empty for the %default locale. %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\TeXOSQueryNumeric#1#2{\TeXOSQuery{#1}{\string-N #2}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryLocaleData} %Query the data for the locale given in the second %argument and store the result in the control sequence %provided in the argument. Leave the second argument empty for the %default locale. %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\TeXOSQueryLocaleData#1#2{\TeXOSQuery{#1}{\string-D #2}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryCwd} %Query the current working directory. % \begin{macrocode} \def\TeXOSQueryCwd#1{\TeXOSQuery{#1}{\string-c}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryHome} %Query the user's home directory. % \begin{macrocode} \def\TeXOSQueryHome#1{\TeXOSQuery{#1}{\string-m}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryTmpDir} %Query the temporary directory. % \begin{macrocode} \def\TeXOSQueryTmpDir#1{\TeXOSQuery{#1}{\string-t}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryVersion} %Query the operating system version. % \begin{macrocode} \def\TeXOSQueryVersion#1{\TeXOSQuery{#1}{\string-r}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryArch} %Query the operating system architecture. % \begin{macrocode} \def\TeXOSQueryArch#1{\TeXOSQuery{#1}{\string-a}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryName} %Query the operating system name. % \begin{macrocode} \def\TeXOSQueryName#1{\TeXOSQuery{#1}{\string-o}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryDateTime} %\changes{1.2}{2017-03-23}{new} %Query the current date and time. % \begin{macrocode} \def\TeXOSQueryDateTime#1{% \TeXOSQuery{#1}{\string-M}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryTimeZones} %\changes{1.2}{2017-03-23}{new} %Query the current time zone mappings. Leave the second argument %empty for the default locale. % \begin{macrocode} \def\TeXOSQueryTimeZones#1#2{% \TeXOSQuery{#1}{\string-Z #2}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryNow} %\changes{1.1}{2016-07-14}{changed catcode of D to 12} %Query the current time stamp. % \begin{macrocode} \def\TeXOSQueryNow#1{% % \end{macrocode} % The \texttt{D} needs category code 12 just in case % \app{texosquery} is running in a backward compatibility mode that % doesn't use \cs{pdfd}. % \begin{macrocode} \edef\@texosquery@restore@D{% \noexpand\catcode`\noexpand\D=\the\catcode`\D\relax}% \catcode`\D=12\relax \TeXOSQuery{#1}{\string-n}% \@texosquery@restore@D } % \end{macrocode} %\end{macro} % %If the file name is supplied using \cs{jobname} it may have %double-quotes which will interfere with things. %\begin{macro}{\texosquerystripquotes} % \begin{macrocode} \def\texosquerystripquotes#1{% \@texosquery@stripquotes#1\@mid@texosquery@stripquotes "\relax"\relax\@end@texosquery@stripquotes } \def\@texosquery@stripquotes#1"#2"{% \@@texosquery@stripquotes#1#2% } \def\@@texosquery@stripquotes#1\@mid@texosquery@stripquotes#2\@end@texosquery@stripquotes{% #1% } % \end{macrocode} %\end{macro} %The restricted mode doesn't permit quotes in the shell escape, so %arguments are only quoted in unrestricted mode. %\begin{macro}{\@texosquery@argquote} %\changes{1.4}{2017-05-05}{new} % \begin{macrocode} \ifnum\texosquery@shellescape=2\relax \def\@texosquery@argquote#1{#1} \else \def\@texosquery@argquote#1{\string'#1\string'} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileDate} %\changes{1.1}{2016-07-14}{changed catcode of D to 12} %Query the time stamp of the file given in the second argument. % \begin{macrocode} \def\TeXOSQueryFileDate#1#2{% % \end{macrocode} % The \texttt{D} needs category code 12 just in case % \app{texosquery} is running in a backward compatibility mode that % doesn't use \cs{pdfd}. % \begin{macrocode} \edef\@texosquery@restore@D{% \noexpand\catcode`\noexpand\D=\the\catcode`\D\relax}% \catcode`\D=12\relax \TeXOSQuery{#1}{\string-d \@texosquery@argquote{\texosquerystripquotes{#2}}}% \@texosquery@restore@D } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileSize} %Query the size of the file given in the second argument. % \begin{macrocode} \def\TeXOSQueryFileSize#1#2{\TeXOSQuery{#1}{\string-s \@texosquery@argquote{\texosquerystripquotes{#2}}}} % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@filelist} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@filelist#1#2#3#4#5{\TeXOSQuery{#1}{% \string#2 \@texosquery@argquote{#3} \@texosquery@argquote{\texosquerystripquotes{#4}} #5}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileList} %List all files in the directory given in the third argument, %separated by the second argument. % \begin{macrocode} \def\TeXOSQueryFileList#1#2#3{% \@texosquery@filelist{#1}{-i}{#2}{#3}{}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileListDateAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by date. % \begin{macrocode} \def\TeXOSQueryFileListDateAsc#1#2#3{% \@texosquery@filelist{#1}{-i}{#2}{#3}{date}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileListDateDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by date in descending order. % \begin{macrocode} \def\TeXOSQueryFileListDateDes#1#2#3{% \@texosquery@filelist{#1}{-i}{#2}{#3}{date\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileListSizeAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by size. % \begin{macrocode} \def\TeXOSQueryFileListSizeAsc#1#2#3{% \@texosquery@filelist{#1}{-i}{#2}{#3}{size}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileListSizeDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by size in descending order. % \begin{macrocode} \def\TeXOSQueryFileListSizeDes#1#2#3{% \@texosquery@filelist{#1}{-i}{#2}{#3}{size\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileListNameAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by name. % \begin{macrocode} \def\TeXOSQueryFileListNameAsc#1#2#3{% \@texosquery@filelist{#1}{-i}{#2}{#3}{name}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileListNameDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by name in descending order. % \begin{macrocode} \def\TeXOSQueryFileListNameDes#1#2#3{% \@texosquery@filelist{#1}{-i}{#2}{#3}{name\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileListNameIgnoreCaseAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by case-insensitive name. % \begin{macrocode} \def\TeXOSQueryFileListNameIgnoreCaseAsc#1#2#3{% \@texosquery@filelist{#1}{-i}{#2}{#3}{iname}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileListNameIgnoreCaseDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by case-insensitive name in descending order. % \begin{macrocode} \def\TeXOSQueryFileListNameIgnoreCaseDes#1#2#3{% \@texosquery@filelist{#1}{-i}{#2}{#3}{iname\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileListExtAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by extension. % \begin{macrocode} \def\TeXOSQueryFileListExtAsc#1#2#3{% \@texosquery@filelist{#1}{-i}{#2}{#3}{ext}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileListExtDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by extension in descending order. % \begin{macrocode} \def\TeXOSQueryFileListExtDes#1#2#3{% \@texosquery@filelist{#1}{-i}{#2}{#3}{ext\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryRegularFileList} %List all regular files. % \begin{macrocode} \def\TeXOSQueryRegularFileList#1#2#3{% \@texosquery@filelist{#1}{-ir}{#2}{#3}{}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQuerySubDirList} %List all sub-directories. % \begin{macrocode} \def\TeXOSQuerySubDirList#1#2#3{% \@texosquery@filelist{#1}{-id}{#2}{#3}{}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryRegularFileListDateAsc} %\changes{1.2}{2017-03-23}{new} %List all regular files sorted by date. % \begin{macrocode} \def\TeXOSQueryRegularFileListDateAsc#1#2#3{% \@texosquery@filelist{#1}{-ir}{#2}{#3}{date}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQuerySubDirListDateAsc} %\changes{1.2}{2017-03-23}{new} %List all sub-directories sorted by date. % \begin{macrocode} \def\TeXOSQuerySubDirListDateAsc#1#2#3{% \@texosquery@filelist{#1}{-id}{#2}{#3}{date}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryRegularFileListDateDes} %\changes{1.2}{2017-03-23}{new} %List all regular files sorted by date in descending order. % \begin{macrocode} \def\TeXOSQueryRegularFileListDateDes#1#2#3{% \@texosquery@filelist{#1}{-ir}{#2}{#3}{date\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQuerySubDirListDateDes} %\changes{1.2}{2017-03-23}{new} %List all sub-directories sorted by date in descending order. % \begin{macrocode} \def\TeXOSQuerySubDirListDateDes#1#2#3{% \@texosquery@filelist{#1}{-id}{#2}{#3}{date\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryRegularFileListSizeAsc} %\changes{1.2}{2017-03-23}{new} %List all regular files sorted by size. % \begin{macrocode} \def\TeXOSQueryRegularFileListSizeAsc#1#2#3{% \@texosquery@filelist{#1}{-ir}{#2}{#3}{size}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQuerySubDirListSizeAsc} %\changes{1.2}{2017-03-23}{new} %List all sub-directories sorted by size. % \begin{macrocode} \def\TeXOSQuerySubDirListSizeAsc#1#2#3{% \@texosquery@filelist{#1}{-id}{#2}{#3}{size}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryRegularFileListSizeDes} %\changes{1.2}{2017-03-23}{new} %List all regular files sorted by size in descending order. % \begin{macrocode} \def\TeXOSQueryRegularFileListSizeDes#1#2#3{% \@texosquery@filelist{#1}{-ir}{#2}{#3}{size\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQuerySubDirListSizeDes} %\changes{1.2}{2017-03-23}{new} %List all sub-directories sorted by size in descending order. % \begin{macrocode} \def\TeXOSQuerySubDirListSizeDes#1#2#3{% \@texosquery@filelist{#1}{-id}{#2}{#3}{size\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryRegularFileListNameAsc} %\changes{1.2}{2017-03-23}{new} %List all regular files sorted by file name. % \begin{macrocode} \def\TeXOSQueryRegularFileListNameAsc#1#2#3{% \@texosquery@filelist{#1}{-ir}{#2}{#3}{name}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQuerySubDirListNameAsc} %\changes{1.2}{2017-03-23}{new} %List all sub-directories sorted by file name. % \begin{macrocode} \def\TeXOSQuerySubDirListNameAsc#1#2#3{% \@texosquery@filelist{#1}{-id}{#2}{#3}{name}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryRegularFileListNameDes} %\changes{1.2}{2017-03-23}{new} %List all regular files sorted by file name in descending order. % \begin{macrocode} \def\TeXOSQueryRegularFileListNameDes#1#2#3{% \@texosquery@filelist{#1}{-ir}{#2}{#3}{name\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQuerySubDirListNameDes} %\changes{1.2}{2017-03-23}{new} %List all sub-directories sorted by name in descending order. % \begin{macrocode} \def\TeXOSQuerySubDirListNameDes#1#2#3{% \@texosquery@filelist{#1}{-id}{#2}{#3}{name\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryRegularFileListNameIgnoreCaseAsc} %\changes{1.2}{2017-03-23}{new} %List all regular files sorted by file case-insensitive name. % \begin{macrocode} \def\TeXOSQueryRegularFileListNameIgnoreCaseAsc#1#2#3{% \@texosquery@filelist{#1}{-ir}{#2}{#3}{iname}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQuerySubDirListNameIgnoreCaseAsc} %\changes{1.2}{2017-03-23}{new} %List all sub-directories sorted by file case-insensitive name. % \begin{macrocode} \def\TeXOSQuerySubDirListNameIgnoreCaseAsc#1#2#3{% \@texosquery@filelist{#1}{-id}{#2}{#3}{iname}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryRegularFileListNameIgnoreCaseDes} %\changes{1.2}{2017-03-23}{new} %List all regular files sorted by file case-insensitive name in descending order. % \begin{macrocode} \def\TeXOSQueryRegularFileListNameIgnoreCaseDes#1#2#3{% \@texosquery@filelist{#1}{-ir}{#2}{#3}{iname\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQuerySubDirListNameIgnoreCaseDes} %\changes{1.2}{2017-03-23}{new} %List all sub-directories sorted by case-insensitive name in descending order. % \begin{macrocode} \def\TeXOSQuerySubDirListNameIgnoreCaseDes#1#2#3{% \@texosquery@filelist{#1}{-id}{#2}{#3}{iname\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryRegularFileListExtAsc} %\changes{1.2}{2017-03-23}{new} %List all regular files sorted by file extension. % \begin{macrocode} \def\TeXOSQueryRegularFileListExtAsc#1#2#3{% \@texosquery@filelist{#1}{-ir}{#2}{#3}{ext}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQuerySubDirListExtAsc} %\changes{1.2}{2017-03-23}{new} %List all sub-directories sorted by file extension. % \begin{macrocode} \def\TeXOSQuerySubDirListExtAsc#1#2#3{% \@texosquery@filelist{#1}{-id}{#2}{#3}{ext}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryRegularFileListExtDes} %\changes{1.2}{2017-03-23}{new} %List all regular files sorted by file extension in descending order. % \begin{macrocode} \def\TeXOSQueryRegularFileListExtDes#1#2#3{% \@texosquery@filelist{#1}{-ir}{#2}{#3}{ext\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQuerySubDirListExtDes} %\changes{1.2}{2017-03-23}{new} %List all sub-directories sorted by extension in descending order. % \begin{macrocode} \def\TeXOSQuerySubDirListExtDes#1#2#3{% \@texosquery@filelist{#1}{-id}{#2}{#3}{ext\string-des}% } % \end{macrocode} %\end{macro} % % %\begin{macro}{\@texosquery@filterfilelist} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@filterfilelist#1#2#3#4#5#6{% \TeXOSQuery{#1}% {% \string#2 \@texosquery@argquote{#3} \@texosquery@argquote{#4} \@texosquery@argquote{\texosquerystripquotes{#5}} #6% }% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterFileList} %Filtered list files in the directory given in the fourth argument, %separated by the second argument. The third argument is the regular %expression used to filter the list. \emph{Take care of backslashes %in the regular expression!} % \begin{macrocode} \def\TeXOSQueryFilterFileList#1#2#3#4{% \@texosquery@filterfilelist{#1}{-f}{#2}{#3}{#4}{}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterFileListDateAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by date. % \begin{macrocode} \def\TeXOSQueryFilterFileListDateAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-f}{#2}{#3}{#4}{date}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterFileListDateDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by date in descending order. % \begin{macrocode} \def\TeXOSQueryFilterFileListDateDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-f}{#2}{#3}{#4}{date\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterFileListSizeAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by size. % \begin{macrocode} \def\TeXOSQueryFilterFileListSizeAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-f}{#2}{#3}{#4}{size}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterFileListSizeDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by size in descending order. % \begin{macrocode} \def\TeXOSQueryFilterFileListSizeDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-f}{#2}{#3}{#4}{size\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterFileListNameAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by file name. % \begin{macrocode} \def\TeXOSQueryFilterFileListNameAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-f}{#2}{#3}{#4}{name}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterFileListNameDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by name in descending order. % \begin{macrocode} \def\TeXOSQueryFilterFileListNameDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-f}{#2}{#3}{#4}{name\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterFileListNameIgnoreCaseAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by file name (case-insensitive). % \begin{macrocode} \def\TeXOSQueryFilterFileListNameIgnoreCaseAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-f}{#2}{#3}{#4}{iname}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterFileListNameIgnoreCaseDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by name in descending order (case-insensitive). % \begin{macrocode} \def\TeXOSQueryFilterFileListNameIgnoreCaseDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-f}{#2}{#3}{#4}{iname\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterFileListExtAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by file extension. % \begin{macrocode} \def\TeXOSQueryFilterFileListExtAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-f}{#2}{#3}{#4}{ext}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterFileListExtDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by extension in descending order. % \begin{macrocode} \def\TeXOSQueryFilterFileListExtDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-f}{#2}{#3}{#4}{ext\string-des}% } % \end{macrocode} %\end{macro} % % %\begin{macro}{\TeXOSQueryFilterRegularFileList} %Filtered list or regular files. % \begin{macrocode} \def\TeXOSQueryFilterRegularFileList#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fr}{#2}{#3}{#4}{}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterSubDirList} %Filtered list of sub-directories. % \begin{macrocode} \def\TeXOSQueryFilterSubDirList#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fd}{#2}{#3}{#4}{}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterSubDirListDateAsc} %\changes{1.2}{2017-03-23}{new} %Filtered sort of sub-directories by file date. % \begin{macrocode} \def\TeXOSQueryFilterSubDirListDateAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fd}{#2}{#3}{#4}{date}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterRegularFileListDateAsc} %\changes{1.2}{2017-03-23}{new} %Filtered sort of regular files by file date. % \begin{macrocode} \def\TeXOSQueryFilterRegularFileListDateAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fr}{#2}{#3}{#4}{date}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterSubDirListDateDes} %\changes{1.2}{2017-03-23}{new} %Filtered sort of sub-directories by file date in descending order. % \begin{macrocode} \def\TeXOSQueryFilterSubDirListDateDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fd}{#2}{#3}{#4}{date\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterRegularFileListDateDes} %\changes{1.2}{2017-03-23}{new} %Filtered sort of regular files by file date in descending order. % \begin{macrocode} \def\TeXOSQueryFilterRegularFileListDateDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fr}{#2}{#3}{#4}{date\string-des}% } % \end{macrocode} %\end{macro} % % %\begin{macro}{\TeXOSQueryFilterSubDirListSizeAsc} %\changes{1.2}{2017-03-23}{new} %Filtered sort of sub-directories by file size. % \begin{macrocode} \def\TeXOSQueryFilterSubDirListSizeAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fd}{#2}{#3}{#4}{size}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterRegularFileListSizeAsc} %\changes{1.2}{2017-03-23}{new} %Filtered sort of regular files by file size. % \begin{macrocode} \def\TeXOSQueryFilterRegularFileListSizeAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fr}{#2}{#3}{#4}{size}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterSubDirListSizeDes} %\changes{1.2}{2017-03-23}{new} %Filtered sort of sub-directories by file size in descending order. % \begin{macrocode} \def\TeXOSQueryFilterSubDirListSizeDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fd}{#2}{#3}{#4}{size\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterRegularFileListSizeDes} %\changes{1.2}{2017-03-23}{new} %Filtered sort of regular files by file size in descending order. % \begin{macrocode} \def\TeXOSQueryFilterRegularFileListSizeDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fr}{#2}{#3}{#4}{size\string-des}% } % \end{macrocode} %\end{macro} % % %\begin{macro}{\TeXOSQueryFilterSubDirListNameAsc} %\changes{1.2}{2017-03-23}{new} %Filtered sort of sub-directories by file name. % \begin{macrocode} \def\TeXOSQueryFilterSubDirListNameAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fd}{#2}{#3}{#4}{name}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterRegularFileListNameAsc} %\changes{1.2}{2017-03-23}{new} %Filtered sort of regular files by file name. % \begin{macrocode} \def\TeXOSQueryFilterRegularFileListNameAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fr}{#2}{#3}{#4}{name}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterSubDirListNameDes} %\changes{1.2}{2017-03-23}{new} %Filtered sort of sub-directories by file name in descending order. % \begin{macrocode} \def\TeXOSQueryFilterSubDirListNameDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fd}{#2}{#3}{#4}{name\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterRegularFileListNameDes} %\changes{1.2}{2017-03-23}{new} %Filtered sort of regular files by file name in descending order. % \begin{macrocode} \def\TeXOSQueryFilterRegularFileListNameDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fr}{#2}{#3}{#4}{name\string-des}% } % \end{macrocode} %\end{macro} % % %\begin{macro}{\TeXOSQueryFilterSubDirListNameIgnoreCaseAsc} %\changes{1.2}{2017-03-23}{new} %Filtered sort of sub-directories by case-insensitive file name. % \begin{macrocode} \def\TeXOSQueryFilterSubDirListNameIgnoreCaseAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fd}{#2}{#3}{#4}{iname}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterRegularFileListNameIgnoreCaseAsc} %\changes{1.2}{2017-03-23}{new} %Filtered sort of regular files by case-insensitive file name. % \begin{macrocode} \def\TeXOSQueryFilterRegularFileListNameIgnoreCaseAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fr}{#2}{#3}{#4}{iname}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterSubDirListNameIgnoreCaseDes} %\changes{1.2}{2017-03-23}{new} %Filtered sort of sub-directories by case-insensitive file name in descending order. % \begin{macrocode} \def\TeXOSQueryFilterSubDirListNameIgnoreCaseDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fd}{#2}{#3}{#4}{iname\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterRegularFileListNameIgnoreCaseDes} %\changes{1.2}{2017-03-23}{new} %Filtered sort of regular files by case-insensitive file name in descending order. % \begin{macrocode} \def\TeXOSQueryFilterRegularFileListNameIgnoreCaseDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fr}{#2}{#3}{#4}{iname\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterSubDirListExtAsc} %\changes{1.2}{2017-03-23}{new} %Filtered sort of sub-directories by file extension. (Added for %completeness as directories don't tend to have extensions.) % \begin{macrocode} \def\TeXOSQueryFilterSubDirListExtAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fd}{#2}{#3}{#4}{ext}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterRegularFileListExtAsc} %\changes{1.2}{2017-03-23}{new} %Filtered sort of regular files by file extension. % \begin{macrocode} \def\TeXOSQueryFilterRegularFileListExtAsc#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fd}{#2}{#3}{#4}{ext}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterSubDirListExtDes} %\changes{1.2}{2017-03-23}{new} %Filtered sort of sub-directories by file extension in descending order. % \begin{macrocode} \def\TeXOSQueryFilterSubDirListExtDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fd}{#2}{#3}{#4}{ext\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilterRegularFileListExtDes} %\changes{1.2}{2017-03-23}{new} %Filtered sort of regular files by file extension in descending order. % \begin{macrocode} \def\TeXOSQueryFilterRegularFileListExtDes#1#2#3#4{% \@texosquery@filterfilelist{#1}{-fr}{#2}{#3}{#4}{ext\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@walk} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@walk#1#2#3#4#5{% \TeXOSQuery{#1}% {% \string-w \@texosquery@argquote{#2} \@texosquery@argquote{#3} \@texosquery@argquote{\texosquerystripquotes{#4}} #5% }% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryWalk} %\changes{1.2}{2017-03-23}{new} %Recursive filtered listing of regular files. % \begin{macrocode} \def\TeXOSQueryWalk#1#2#3#4{% \@texosquery@walk{#1}{#2}{#3}{#4}{}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryWalkDateAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by date. % \begin{macrocode} \def\TeXOSQueryWalkDateAsc#1#2#3#4{% \@texosquery@walk{#1}{#2}{#3}{#4}{date}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryWalkDateDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by date in descending order. % \begin{macrocode} \def\TeXOSQueryWalkDateDes#1#2#3#4{% \@texosquery@walk{#1}{#2}{#3}{#4}{date\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryWalkSizeAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by file size. % \begin{macrocode} \def\TeXOSQueryWalkSizeAsc#1#2#3#4{% \@texosquery@walk{#1}{#2}{#3}{#4}{size}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryWalkSizeDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by file size in descending order. % \begin{macrocode} \def\TeXOSQueryWalkSizeDes#1#2#3#4{% \@texosquery@walk{#1}{#2}{#3}{#4}{size\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryWalkNameAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by file name. % \begin{macrocode} \def\TeXOSQueryWalkNameAsc#1#2#3#4{% \@texosquery@walk{#1}{#2}{#3}{#4}{name}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryWalkNameDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by file name in descending order. % \begin{macrocode} \def\TeXOSQueryWalkNameDes#1#2#3#4{% \@texosquery@walk{#1}{#2}{#3}{#4}{name\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryWalkNameIgnoreCaseAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by file name (case-insensitive). % \begin{macrocode} \def\TeXOSQueryWalkNameIgnoreCaseAsc#1#2#3#4{% \@texosquery@walk{#1}{#2}{#3}{#4}{iname}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryWalkNameIgnoreCaseDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by file name (case-insensitive) in descending order. % \begin{macrocode} \def\TeXOSQueryWalkNameIgnoreCaseDes#1#2#3#4{% \@texosquery@walk{#1}{#2}{#3}{#4}{iname\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryWalkExtAsc} %\changes{1.2}{2017-03-23}{new} %As above, but sort by file extension. % \begin{macrocode} \def\TeXOSQueryWalkExtAsc#1#2#3#4{% \@texosquery@walk{#1}{#2}{#3}{#4}{ext}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryWalkExtDes} %\changes{1.2}{2017-03-23}{new} %As above, but sort by file extension in descending order. % \begin{macrocode} \def\TeXOSQueryWalkExtDes#1#2#3#4{% \@texosquery@walk{#1}{#2}{#3}{#4}{ext\string-des}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFileURI} %Get the URI of the file given in the second argument. % \begin{macrocode} \def\TeXOSQueryFileURI#1#2{\TeXOSQuery{#1}{\string-u \@texosquery@argquote{\texosquerystripquotes{#2}}}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryFilePath} %Get the canonical path of the file given in the second argument. % \begin{macrocode} \def\TeXOSQueryFilePath#1#2{\TeXOSQuery{#1}{\string-p \@texosquery@argquote{\texosquerystripquotes{#2}}}} % \end{macrocode} %\end{macro} % %\begin{macro}{\TeXOSQueryDirName} %\changes{1.1}{2016-07-14}{new} %Get the canonical path of the directory containing the file given %in the second argument. % \begin{macrocode} \def\TeXOSQueryDirName#1#2{\TeXOSQuery{#1}{\string-e \@texosquery@argquote{\texosquerystripquotes{#2}}}} % \end{macrocode} %\end{macro} % %\subsubsection{Pattern Formats} %\label{sec:patternformats} %There are two basic types of patterns: date/time or numeric. %A pattern is stored in a control sequence using custom markup %that's easier for \TeX\ to parse than it would be to parse %strings in the form \verb|YYYY-MM| or \verb|#,##0|. This internal %pattern format can be obtained through capturing the output %of \app{texosquery}'s \shortarg{D} action, but patterns can also be %constructed using %\begin{definition} %\cs{texosquerydefpattern}\marg{cs}\marg{pattern specs} %\end{definition} %The pattern is stored in \meta{cs}. The \meta{pattern specs} depend %on whether a date-time or numeric pattern is required. %For a date-time pattern, each date/time element is identified %using %\begin{definition} %\cs{texosquerydtf}\marg{n}\marg{identifier} %\end{definition} %where \meta{identifier} identifies the element type (such as %\verb|M| for month or \verb|s| for seconds) and \meta{n} %indicates how the element should be formatted, where \meta{n} %is an integer from 1 to 4. For example if \meta{n} is 2 %and \meta{identifier} is \verb|M|, then this indicates the %\verb|MM| format, which produces a two-digit number. % %Since it's rather cumbersome to keep typing \cs{texosquerydtf} %and it can make for rather hard to read code, %\cs{texosquerydefpattern} locally redefines \verb|\%| to expand to %\cs{texosquerydtf}. This means that if you do, for example: %\begin{verbatim} %\texosquerydefpattern{\pattern}{\%2d/\%2M/\%4y} %\end{verbatim} %then \cs{pattern} is defined to %\begin{verbatim} %\texosquerydtf 2d/\texosquerydtf 2M/\texosquerydtf 4y %\end{verbatim} %When simply used within the document, this just expands to the %pattern format. For example: %\begin{verbatim} %Pattern: \pattern. %\end{verbatim} %will display \qt{Pattern: dd/MM/yyyy} in the PDF. However, %when used with \cs{texosqueryfmtdatetime}, the definition %of \cs{texosquerydtf} changes to reproduce the required %date/time element. % %For example: %\begin{verbatim} %\texosquerydefpattern{\pattern}{\%2d/\%2M/\%4y \%2H:\%2m:\%2s \%2Z} % %Pattern: \pattern. % %\TeXOSQueryDateTime{\datetimedata} % %\ifx\datetimedata\empty % Query Failed! %\else % \expandafter\texosqueryfmtdatetime\expandafter\pattern\datetimedata %\fi %\end{verbatim} % %The numeric patterns are rather more complicated. The %\meta{pattern specs} now needs to use the following formats: % %\begin{definition} %\cs{texosquerypatnum}\marg{+ve/-ve numeric pattern} %\end{definition} %This is a numeric pattern applied to a number regardless of %whether the number is positive or negative. (If negative, the %minus sign is automatically inserted.) This is rather a long %and cumbersome command to type, so \cs{texosquerydefpattern} %locally defines \cs{numfmt} to expand to it. % %\begin{definition} %\cs{texosquerypatplusminus}\marg{+ve numeric pattern}\marg{-ve numeric %pattern} %\end{definition} %This provides a pattern \meta{+ve numeric pattern} to use if the %number is positive and a patter \meta{-ve numeric pattern} to use %if the number is negative. Again \cs{texosquerydefpattern} %locally defines a shortcut, \cs{pmnumfmt}, to expand to this %command. % %\begin{definition} %\cs{texosquerypatsinum}\marg{decimal pattern}\marg{mantissa %pattern} %\end{definition} %This provides a pattern to use for SI numbers where \meta{decimal %pattern} is a pattern for the decimal number part (before the %exponent symbol) and \meta{mantissa} is the pattern for the integer %part in the mantissa (after the exponent symbol). %The locally defined shortcut is \cs{sinumfmt}. The \meta{decimal %pattern} will typically be in the form: %\begin{definition} %\cs{texosquerypatdec}\marg{integer pattern}\marg{fraction pattern} %\end{definition} %This indicates a decimal pattern where the \meta{integer pattern} %is applied to the part before the decimal separator and %\meta{fraction pattern} is applied to the part after the separator. The shortcut is \cs{decfmt}. % %\begin{definition} %\cs{texosquerypatprefixcurrency}\marg{decimal pattern}\marg{text} %\end{definition} %This indicates a currency pattern with a prefixed currency symbol where \meta{text} is inserted %before the currency symbol. The shortcut is \cs{pcur}. %The \meta{decimal pattern} will typically use %\cs{texosquerypatdec}\marg{int}\meta{frac}. (Similarly for the %following.) % %\begin{definition} %\cs{texosquerypatprefixicurrency}\marg{decimal pattern}\marg{text} %\end{definition} %This indicates an international currency pattern with a prefixed %international currency symbol where \meta{text} is inserted %before the symbol. The shortcut is \cs{picur}. % %\begin{definition} %\cs{texosquerypatsuffixcurrency}\marg{decimal pattern}\marg{text} %\end{definition} %This indicates a currency pattern with a suffixed international %currency symbol where \meta{text} is inserted %after the currency symbol. The shortcut is \cs{scur}. % %\begin{definition} %\cs{texosquerypatsuffixicurrency}\marg{decimal pattern}\marg{text} %\end{definition} %This indicates an international currency pattern with a suffixed %international currency symbol where \meta{text} is inserted %after the symbol. The shortcut is \cs{sicur}. % %\begin{definition} %\cs{texosquerypatprefixpercent}\marg{decimal pattern}\marg{text} %\end{definition} %This indicates a percentage pattern with a prefixed percent symbol where \meta{text} is inserted %before the symbol. The shortcut is \cs{ppct}. % %\begin{definition} %\cs{texosquerypatsuffixpercent}\marg{decimal pattern}\marg{text} %\end{definition} %This indicates a percentage pattern with a suffixed percent symbol where \meta{text} is inserted %after the symbol. The shortcut is \cs{spct}. % %\begin{definition} %\cs{texosquerypatprefixpermill}\marg{decimal pattern}\marg{text} %\end{definition} %This indicates a per-mill pattern with a prefixed per-mill symbol where \meta{text} is inserted %before the symbol. The shortcut is \cs{ppml}. % %\begin{definition} %\cs{texosquerypatsuffixpermill}\marg{decimal pattern}\marg{text} %\end{definition} %This indicates a per-mill pattern with a suffixed per-mill symbol where \meta{text} is inserted %after the symbol. The shortcut is \cs{spml}. % %\begin{important} %The integer parts \meta{integer part}, \meta{fraction part} %and \meta{mantissa} must have \emph{exactly} ten digit identifiers. %(\TeX\ can't reach 11 digit numbers.) %\end{important} % %There are two types of digit identifiers: %\begin{definition} %\cs{texosquerypatdigit} %\end{definition} %This indicates a digit that must be displayed, even if it's not %significant (for example a leading zero). The shortcut command is \verb|\0| (backslash zero). % %\begin{definition} %\cs{texosquerypatdigitnozero} %\end{definition} %This indicates a digit that should only be displayed if it's %significant. (For example, if it's a leading zero, it's not shown.) %The shortcut command is \verb|\#| (backslash hash). % %The number group separator can be inserted using %\begin{definition} %\cs{texosquerypatgroupsep} %\end{definition} %The shortcut command is \verb|\,| (backslash comma). % %The sign can be inserted using %\begin{definition} %\cs{texosquerypatminus} %\end{definition} %This ensures the sign is displayed even if the number is positive. %The shortcut command is \verb|\-| (backslash hyphen). % %Here's an example of a decimal pattern: %\begin{verbatim} %\texosquerydefpattern{\numpattern}{% % \numfmt{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\#\#\#\#\#\#\#\#\#}}} %\end{verbatim} %The pattern can be applied to a number using \cs{texosqueryfmtnumber}: %\begin{verbatim} %\texosqueryfmtnumber{\numpattern}{123}{4567}{2} %\end{verbatim} %which produces: 12,345.67 (the group and decimal separators can be %redefined as appropriate). % %Here's an example of a scientific number: %\begin{verbatim} %\texosquerydefpattern{\sinumpattern}{% % \sinumfmt % {\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\#\#\#\#\#\#\#\#\#}}% % {\-\#\#\#\#\#\#\#\#\0\0}% %} %\end{verbatim} %The pattern can be applied to a number: %\begin{verbatim} %\texosqueryfmtnumber{\sinumpattern}{1}{234567}{3} %\end{verbatim} %which produces: 1.234567E+03 % %Here's an integer pattern: %\begin{verbatim} %\texosquerydefpattern{\intpattern}{% % \patnumfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}} %\end{verbatim} %The pattern applied to a number: %\begin{verbatim} %\texosqueryfmtnumber{\intpattern}{123}{4567}{2} %\end{verbatim} %which produces: 12,345 (the fractional part has been omitted). % %Here's a currency pattern that applies a different format for %positive and negative numbers: %\begin{verbatim} %\texosquerydefpattern{\curpattern}{% % \pmnumfmt % {\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{}}% % {\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{\-}}} %\end{verbatim} %This uses the \meta{text} part of \cs{pcur} to insert the sign %before the currency symbol (but only for negative values). %\begin{verbatim} %\texosqueryfmtnumber{\curpattern}{-1234567}{0}{0} %\end{verbatim} %This produces: $-$\$12,345,678.00 (again the symbol and separators %can be redefined as appropriate). % %Here's an example of a percentage pattern: %\begin{verbatim} %\texosquerydefpattern{\pcpattern}{% % \numfmt{\spct{\#\,\#\#\#\,\#\#\#\,\#\#\0}{}}} %\end{verbatim} %The pattern can similarly be applied to a number using %\cs{texosqueryfmtnumber}. % %\begin{macro}{\texosquerydtf} %\changes{1.2}{2017-03-23}{new} %Date/time format placeholder. The second argument is the %placeholder character and the first argument is the number of %occurrences of that character in the placeholder. The default %definition just converts it back to pattern format used by %Java's %\href{http://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html}{SimpleDateFormat %class}. The pattern interprets $\ge4$ as a single case, so this %will only produce a maximum of four characters. % \begin{macrocode} \def\texosquerydtf#1#2{% \ifcase#1 \or #2% \or #2#2% \or #2#2#2% \else #2#2#2#2% \fi } % \end{macrocode} %\end{macro} % %The following commands are used to display the pattern in the %document text to reproduce the pattern string recognised by Java. %This is provided for debugging to check the pattern. In most cases %the pattern will be applied to a number rather than simply %displayed. % %\begin{macro}{\texosquerypatstr} %\changes{1.2}{2017-03-23}{new} %Quoted string contained in number format. % \begin{macrocode} \def\texosquerypatstr#1{'#1'} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatquote} %\changes{1.2}{2017-03-23}{new} %Literal quote contained in number format. % \begin{macrocode} \def\texosquerypatquote{''} % \end{macrocode} %\end{macro} %Number format place holders. %\begin{macro}{\texosquerypatplusminus} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatplusminus#1#2{#1;#2} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatnum} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatnum#1{#1} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatsinum} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatsinum#1#2{#1E#2} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatdec} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatdec#1#2{#1.#2} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatprefixcurrency} %\changes{1.2}{2017-03-23}{new} %First argument is a number, the second is optional text before the %currency symbol. This will require UTF-8 support otherwise it will %need redefining as appropriate. (Similarly for the other currency %commands and for the per-mill commands.) % \begin{macrocode} \def\texosquerypatprefixcurrency#1#2{#2¤#1} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatprefixicurrency} %\changes{1.2}{2017-03-23}{new} %As above but use international currency symbol. % \begin{macrocode} \def\texosquerypatprefixicurrency#1#2{#2¤¤#1} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatsuffixcurrency} %\changes{1.2}{2017-03-23}{new} %First argument is a number, the second is optional text after the %currency symbol. % \begin{macrocode} \def\texosquerypatsuffixcurrency#1#2{#1¤#2} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatsuffixicurrency} %\changes{1.2}{2017-03-23}{new} %As above but use international currency symbol. % \begin{macrocode} \def\texosquerypatsuffixicurrency#1#2{#1¤¤#2} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatdigit} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatdigit{0} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatdigitnozero} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatdigitnozero{\#} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatminus} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatminus{-} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatgroupsep} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatgroupsep{,} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatprefixpercent} %\changes{1.2}{2017-03-23}{new} %The first argument is the value, the second argument is optional %text before the percent symbol. % \begin{macrocode} \def\texosquerypatprefixpercent#1#2{#2\%#1} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatsuffixpercent} %\changes{1.2}{2017-03-23}{new} %The first argument is the value, the second argument is optional %text after the percent symbol. % \begin{macrocode} \def\texosquerypatsuffixpercent#1#2{#1\%#2} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatprefixpermill} %\changes{1.2}{2017-03-23}{new} %The first argument is the value, the second argument is optional %text before the per-mill symbol. % \begin{macrocode} \def\texosquerypatprefixpermill#1#2{#2‰#1} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatsuffixpermill} %\changes{1.2}{2017-03-23}{new} %The first argument is the value, the second argument is optional %text after the per-mill symbol. % \begin{macrocode} \def\texosquerypatsuffixpermill#1#2{#1‰#2} % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@pattern@shortcuts} %Provide much shorter cuts for the convenience of directly defining %patterns with \cs{texosquerydefpattern}. %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@pattern@shortcuts{% \def\%{\noexpand\texosquerydtf}% \def\0{\noexpand\texosquerypatdigit}% \def\#{\noexpand\texosquerypatdigitnozero}% \def\-{\noexpand\texosquerypatminus}% \def\,{\noexpand\texosquerypatgroupsep}% \def\numfmt{\noexpand\texosquerypatnum}% \def\pmnumfmt{\noexpand\texosquerypatplusminus}% \def\sinumfmt{\noexpand\texosquerypatsinum}% \def\decfmt{\noexpand\texosquerypatdec}% \def\pcur{\noexpand\texosquerypatprefixcurrency}% \def\picur{\noexpand\texosquerypatprefixicurrency}% \def\scur{\noexpand\texosquerypatsuffixcurrency}% \def\sicur{\noexpand\texosquerypatsuffixicurrency}% \def\ppct{\noexpand\texosquerypatprefixpercent}% \def\spct{\noexpand\texosquerypatsuffixpercent}% \def\ppml{\noexpand\texosquerypatprefixpermill}% \def\spml{\noexpand\texosquerypatsuffixpermill}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerydefpattern} %Define a new pattern using the shortcut markup. The first argument %is the name of the control sequence in which to store the pattern %provided in the second argument. Be careful of any fragile commands %within the second argument. They will need protecting! %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerydefpattern#1#2{% \begingroup \@texosquery@pattern@shortcuts \@texosquery@edef\@texosquery@tmp{\endgroup\def\noexpand#1{#2}}\@texosquery@tmp } % \end{macrocode} %\changes{1.7}{2020-02-04}{renamed scratch variable} %\end{macro} % % %\subsubsection{Applying Date-Time Patterns} %\label{sec:applydatetimepatterns} %In order to apply date-time patterns, we need all the information about the %date or time we're trying to format. %\begin{enumerate} %\item Era needed by the \texttt{G} designator. Java %identifies the era by an integer (0 = BC and 1 = AD). %\item Era text (e.g. AD) can be supplied by a macro. %\item Year needed by the \texttt{y} designator. %\item Week year needed by the \texttt{Y} designator. %\item Month in year needed by the \texttt{M} or \texttt{L} %designators. %\item Month name needed by the \texttt{M} or \texttt{L} %designators. This can be provided as macros that convert the month %number to the name. Four macros are needed: short, full, standalone %short and standalone full. %\item Week in year needed by the \texttt{w} designator. %\item Week in month needed by the \texttt{W} designator. %\item Day in year needed by the \texttt{D} designator. %\item Day in month needed by the \texttt{d} designator. %\item Day of week in month needed by the \texttt{F} designator. %\item Day name in week needed by the \texttt{E} designator. %This can be provided as a macros that accepts the day of week %number. The full form is needed for 4 letter patterns otherwise a %short form. %\item Day number of week (1 = Monday, 7 = Sunday) needed by the %\texttt{u} designator. This means that %the above day of week name macros needs to use Monday=1 base indexing. %This means that \cs{pgfcalendarweekdayname} can't be used directly. %\item AM/PM identifier needed by the \texttt{a} %designator. Assume 0 = AM and 1 = PM to match Java. %\item AM/PM text can be provided by a macro. %\item Hour of the day (0-23) needed by the \texttt{H} %designator. %\item Hour in day (1-24) needed by the \texttt{k} %designator. %\item Hour in am/pm (0-11) needed by the \texttt{K} designator. %\item Hour in am/pm (1-12) needed by the \texttt{h} designator. %\item Minute in hour needed by the \texttt{m} designator. %\item Second in minute needed by the \texttt{s} designator. %\item Millisecond needed by the \texttt{S} designator. %\item Time zone needed by the \texttt{z}, \texttt{Z} and \texttt{X} %designators. This will require macros for converting the time zone %to each of those formats. %\end{enumerate} %Supply a general utility command that has enough arguments to pass %all the above information. A higher level user command can then be %provided that determines all the arguments to provide an easier %interface. % %The arguments need to be the pattern followed by %\marg{era id}\marg{year}\marg{week year}\marg{month}\marg{week in %year}\marg{week in month}\marg{day in year}\marg{day in month}\marg{day of %week in month}\marg{day number of week}\marg{am/pm id}\marg{hour of day %(H)}\marg{hour in day (k)}\marg{hour in am/pm (K)}\marg{hour in %am/pm (h)}\marg{minute in hour}\marg{second in minute}\marg{millisecond}\marg{time zone} %The arguments must all be integers except for the time zone which %must be in the form %\marg{TZh}\marg{TZm}\marg{id}\marg{dst flag}. These are the time zone hour and %min offsets, time zone ID and daylight saving flag (1 if daylight %saving in effect otherwise 0). These arguments can all be %obtained using the \longarg{date-time} / \shortarg{M} action. % %We'll need some helper macros to get around the nine argument %maximum limit. % %\begin{macro}{\texosqueryfmtdatetime} %\changes{1.2}{2017-03-23}{new} %The general utility command to format a pattern. The first argument %is the pattern. After that are the date-time data arguments. % \begin{macrocode} \def\texosqueryfmtdatetime#1{% \def\@texosquery@fmt@dt@pattern{#1}% \@texosquery@fmt@getera } % \end{macrocode} %\end{macro} % %All the remaining arguments except for the time zone must be %integers. These are padded using \cs{@texosquery@paddigits}. % %\begin{macro}{\@texosquery@fmt@getera} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getera#1{% \edef\@texosquery@fmt@G{\@texosquery@paddigits{#1}}% \@texosquery@fmt@getyear } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getyear} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getyear#1{% \edef\@texosquery@fmt@y{\@texosquery@paddigits{#1}}% \@texosquery@fmt@getweekyear } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getweekyear} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getweekyear#1{% \edef\@texosquery@fmt@Y{\@texosquery@paddigits{#1}}% \@texosquery@fmt@getmonth } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getmonth} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getmonth#1{% \edef\@texosquery@fmt@M{\@texosquery@paddigits{#1}}% \let\@texosquery@fmt@L\@texosquery@fmt@M \@texosquery@fmt@getweekinyear } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getweekinyear} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getweekinyear#1{% \edef\@texosquery@fmt@w{\@texosquery@paddigits{#1}}% \@texosquery@fmt@getweekinmonth } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getweekinmonth} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getweekinmonth#1{% \edef\@texosquery@fmt@W{\@texosquery@paddigits{#1}}% \@texosquery@fmt@getdayinyear } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getdayinyear} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getdayinyear#1{% \edef\@texosquery@fmt@D{\@texosquery@paddigits{#1}}% \@texosquery@fmt@getdayinmonth } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getdayinmonth} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getdayinmonth#1{% \edef\@texosquery@fmt@d{\@texosquery@paddigits{#1}}% \@texosquery@fmt@getdayofweekinmonth } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getdayofweekinmonth} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getdayofweekinmonth#1{% \edef\@texosquery@fmt@F{\@texosquery@paddigits{#1}}% \@texosquery@fmt@getdaynumberofweek } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getdaynumberofweek} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getdaynumberofweek#1{% \edef\@texosquery@fmt@u{\@texosquery@paddigits{#1}}% \let\@texosquery@fmt@E\@texosquery@fmt@u \@texosquery@fmt@getampm } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getampm} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getampm#1{% \edef\@texosquery@fmt@a{\@texosquery@paddigits{#1}}% \@texosquery@fmt@gethourindayH } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@gethourindayH} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@gethourindayH#1{% \edef\@texosquery@fmt@H{\@texosquery@paddigits{#1}}% \@texosquery@fmt@gethourindayk } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@gethourindayk} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@gethourindayk#1{% \edef\@texosquery@fmt@k{\@texosquery@paddigits{#1}}% \@texosquery@fmt@gethourinampmK } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@gethourinampmK} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@gethourinampmK#1{% \edef\@texosquery@fmt@K{\@texosquery@paddigits{#1}}% \@texosquery@fmt@gethourinampmh } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@gethourinampmh} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@gethourinampmh#1{% \edef\@texosquery@fmt@h{\@texosquery@paddigits{#1}}% \@texosquery@fmt@getminute } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getminute} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getminute#1{% \edef\@texosquery@fmt@m{\@texosquery@paddigits{#1}}% \@texosquery@fmt@getsecond } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getsecond} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getsecond#1{% \edef\@texosquery@fmt@s{\@texosquery@paddigits{#1}}% \@texosquery@fmt@getmillisecond } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@getmillisecond} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@getmillisecond#1{% \edef\@texosquery@fmt@S{\@texosquery@paddigits{#1}}% \@texosquery@fmt@gettimezone } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@gettimezone} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@gettimezone#1{% \def\@texosquery@fmt@Z{#1}% \def\@texosquery@fmt@z{#1}% \def\@texosquery@fmt@X{#1}% % \end{macrocode} %All data now supplied. Temporarily redefine pattern markup and %process the pattern. % \begin{macrocode} \begingroup \@texosquery@setup@dtpattern \@texosquery@fmt@dt@pattern \endgroup } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@setup@dtpattern} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@setup@dtpattern{% \let\texosquerydtf\@texosquery@fmt@dtf \let\texosquerypatstr\texosquerypatfmtstr \let\texosquerypatquote\texosquerypatfmtquote } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@paddigits@pos} %\changes{1.2}{2017-03-23}{new} %Pad positive number to 10 digits. \TeX\ can't reach 11 digits, so this is %the maximum representation. % \begin{macrocode} \def\@texosquery@paddigits@pos#1{% \ifnum#1<10 000000000\number#1 \else \ifnum#1<100 00000000\number#1 \else \ifnum#1<1000 0000000\number#1 \else \ifnum#1<10000 000000\number#1 \else \ifnum#1<100000 00000\number#1 \else \ifnum#1<1000000 0000\number#1 \else \ifnum#1<10000000 000\number#1 \else \ifnum#1<100000000 00\number#1 \else \ifnum#1<1000000000 0\number#1 \else \number#1 \fi \fi \fi \fi \fi \fi \fi \fi \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@paddigits} %\changes{1.2}{2017-03-23}{new} %This will expand to 11 characters (sign followed by 10 digits). % \begin{macrocode} \def\@texosquery@paddigits#1{% \ifnum#1<0 % \end{macrocode} %Move the minus sign outside. % \begin{macrocode} -\expandafter\@texosquery@paddigits@pos\expandafter {\@texosquery@gobble#1}% \else +\@texosquery@paddigits@pos{#1}% \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@paddigits@trailing} %\changes{1.2}{2017-03-23}{new} %Pad trailing zeros. % \begin{macrocode} \def\@texosquery@paddigits@trailing#1{% \expandafter\@texosquery@tenoften@then@gobble #10000000000\@texosquery@end@tenoften } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@tenoften@then@gobble} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@tenoften@then@gobble#1#2#3#4#5#6#7#8#9{% #1#2#3#4#5#6#7#8#9% \@texosquery@lastoften@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@lastoften@gobble} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@lastoften@gobble#1#2\@texosquery@end@tenoften{#1} % \end{macrocode} %\end{macro} % %Provide commands to select certain digits. (Sign not included.) % %\begin{macro}{\@texosquery@firstoften} %\changes{1.2}{2017-03-23}{new} %First of ten. % \begin{macrocode} \def\@texosquery@firstoften#1#2#3#4#5#6#7#8#9{% #1% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@secondoften} %\changes{1.2}{2017-03-23}{new} %Second of ten. % \begin{macrocode} \def\@texosquery@secondoften#1#2#3#4#5#6#7#8#9{% #2% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@thirdoften} %\changes{1.2}{2017-03-23}{new} %Third of ten. % \begin{macrocode} \def\@texosquery@thirdoften#1#2#3#4#5#6#7#8#9{% #3% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fourthoften} %\changes{1.2}{2017-03-23}{new} %Fourth of ten. % \begin{macrocode} \def\@texosquery@fourthoften#1#2#3#4#5#6#7#8#9{% #4% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fifthoften} %\changes{1.2}{2017-03-23}{new} %Fifth of ten. % \begin{macrocode} \def\@texosquery@fifthoften#1#2#3#4#5#6#7#8#9{% #5% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@sixthoften} %\changes{1.2}{2017-03-23}{new} %Sixth of ten. % \begin{macrocode} \def\@texosquery@sixthoften#1#2#3#4#5#6#7#8#9{% #6% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@seventhoften} %\changes{1.2}{2017-03-23}{new} %Seventh of ten. % \begin{macrocode} \def\@texosquery@seventhoften#1#2#3#4#5#6#7#8#9{% #7% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@eighthoften} %\changes{1.2}{2017-03-23}{new} %Eighth of ten. % \begin{macrocode} \def\@texosquery@eighthoften#1#2#3#4#5#6#7#8#9{% #8% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@ninthoften} %\changes{1.2}{2017-03-23}{new} %Ninth of ten. % \begin{macrocode} \def\@texosquery@ninthoften#1#2#3#4#5#6#7#8#9{% #9% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@tenthoften} %\changes{1.2}{2017-03-23}{new} %Tenth of ten. % \begin{macrocode} \def\@texosquery@tenthoften#1#2#3#4#5#6#7#8#9{% \@texosquery@firstofone } % \end{macrocode} %\end{macro} % %Now macros to select first $n$ of ten. % %\begin{macro}{@texosquery@firsttwooften} %\changes{1.2}{2017-03-23}{new} %First two of ten. % \begin{macrocode} \def\@texosquery@firsttwooften#1#2#3#4#5#6#7#8#9{% #1#2% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@firstthreeoften} %\changes{1.2}{2017-03-23}{new} %First three of ten. % \begin{macrocode} \def\@texosquery@firstthreeoften#1#2#3#4#5#6#7#8#9{% #1#2#3% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@firstfouroften} %\changes{1.2}{2017-03-23}{new} %First four of ten. % \begin{macrocode} \def\@texosquery@firstfouroften#1#2#3#4#5#6#7#8#9{% #1#2#3#4% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@firstfiveoften} %\changes{1.2}{2017-03-23}{new} %First five of ten. % \begin{macrocode} \def\@texosquery@firstfiveoften#1#2#3#4#5#6#7#8#9{% #1#2#3#4#5% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@firstsixoften} %\changes{1.2}{2017-03-23}{new} %First six of ten. % \begin{macrocode} \def\@texosquery@firstsixoften#1#2#3#4#5#6#7#8#9{% #1#2#3#4#5#6% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@firstsevenoften} %\changes{1.2}{2017-03-23}{new} %First seven of ten. % \begin{macrocode} \def\@texosquery@firstsevenoften#1#2#3#4#5#6#7#8#9{% #1#2#3#4#5#6#7% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@firsteightoften} %\changes{1.2}{2017-03-23}{new} %First eight of ten. % \begin{macrocode} \def\@texosquery@firsteightoften#1#2#3#4#5#6#7#8#9{% #1#2#3#4#5#6#7#8% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@firstnineoften} %\changes{1.2}{2017-03-23}{new} %First nine of ten. % \begin{macrocode} \def\@texosquery@firstnineoften#1#2#3#4#5#6#7#8#9{% #1#2#3#4#5#6#7#8#9% % \end{macrocode} %Grab tenth argument and discard. % \begin{macrocode} \@texosquery@gobble } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@alltenoften} %\changes{1.2}{2017-03-23}{new} %All ten. % \begin{macrocode} \def\@texosquery@alltenoften#1#2#3#4#5#6#7#8#9{% #1#2#3#4#5#6#7#8#9% \@texosquery@firstofone } % \end{macrocode} %\end{macro} % %Select last $n$ of ten. % %\begin{macro}{@texosquery@lasttwooften} %\changes{1.2}{2017-03-23}{new} %Last two of ten. % \begin{macrocode} \def\@texosquery@lasttwooften#1#2#3#4#5#6#7#8#9{% #9% \@texosquery@firstofone } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@lastthreeoften} %\changes{1.2}{2017-03-23}{new} %Last three of ten. % \begin{macrocode} \def\@texosquery@lastthreeoften#1#2#3#4#5#6#7#8#9{% #8#9% \@texosquery@firstofone } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@lastfouroften} %\changes{1.2}{2017-03-23}{new} %Last four of ten. % \begin{macrocode} \def\@texosquery@lastfouroften#1#2#3#4#5#6#7#8#9{% #7#8#9% \@texosquery@firstofone } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@lastfiveoften} %\changes{1.2}{2017-03-23}{new} %Last five of ten. % \begin{macrocode} \def\@texosquery@lastfiveoften#1#2#3#4#5#6#7#8#9{% #6#7#8#9% \@texosquery@firstofone } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@lastsixoften} %\changes{1.2}{2017-03-23}{new} %Last six of ten. % \begin{macrocode} \def\@texosquery@lastsixoften#1#2#3#4#5#6#7#8#9{% #5#6#7#8#9% \@texosquery@firstofone } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@lastsevenoften} %\changes{1.2}{2017-03-23}{new} %Last seven of ten. % \begin{macrocode} \def\@texosquery@lastsevenoften#1#2#3#4#5#6#7#8#9{% #4#5#6#7#8#9% \@texosquery@firstofone } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@lasteightoften} %\changes{1.2}{2017-03-23}{new} %Last eight of ten. % \begin{macrocode} \def\@texosquery@lasteightoften#1#2#3#4#5#6#7#8#9{% #3#4#5#6#7#8#9% \@texosquery@firstofone } % \end{macrocode} %\end{macro} % %\begin{macro}{@texosquery@lastnineoften} %\changes{1.2}{2017-03-23}{new} %Last nine of ten. % \begin{macrocode} \def\@texosquery@lastnineoften#1#2#3#4#5#6#7#8#9{% #2#3#4#5#6#7#8#9% \@texosquery@firstofone } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmtminus} %\changes{1.2}{2017-03-23}{new} %Minus symbol for use in date-time patterns. % \begin{macrocode} \def\@texosquery@fmtminus{\texosquerypatfmtminus} % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmtplus} %\changes{1.2}{2017-03-23}{new} %Plus symbol for use in date-time patterns. Omit by default. % \begin{macrocode} \def\@texosquery@fmtplus{} % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmtsign} %\changes{1.2}{2017-03-23}{new} %Plus or minus sign for use in date-time patterns. % \begin{macrocode} \def\@texosquery@fmtsign#1{% \ifx#1+\@texosquery@fmtplus\else\@texosquery@fmtminus\fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@atleastonedigit} %\changes{1.2}{2017-03-23}{new} %At least one digit with leading zeros removed. % \begin{macrocode} \def\@texosquery@atleastonedigit#1{% \ifnum#1<0 \@texosquery@fmtminus\number-#1 \else \number#1 \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@atleastfourdigits} %\changes{1.2}{2017-03-23}{new} %At least four digits, possible padded with zeros to make up four. The first %argument is the sign, then follow the ten digits. % \begin{macrocode} \def\@texosquery@atleastfourdigits#1{% \@texosquery@at@leastfourdigits#1\@texosquery@end@atleastfourdigits } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@at@leastfourdigits} %\changes{1.2}{2017-03-23}{new} %At least four digits, possible padded with zeros to make up four. The first %argument is the sign, then follow the ten digits. % \begin{macrocode} \def\@texosquery@at@leastfourdigits#1#2\@texosquery@end@atleastfourdigits{% \@texosquery@fmtsign{#1}% \ifnum#2<1000 \@texosquery@lastfouroften#2% \else \number#2 \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@threedigitsexactly} %\changes{1.2}{2017-03-23}{new} %Exactly three digits. % \begin{macrocode} \def\@texosquery@threedigitsexactly#1{% \@texosquery@threedigits@exactly#1\@texosquery@threedigits@exactly }% % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@threedigits@exactly} %\changes{1.2}{2017-03-23}{new} %Exactly three digits. % \begin{macrocode} \def\@texosquery@threedigits@exactly#1#2\@texosquery@threedigits@exactly{% \@texosquery@fmtsign{#1}% \@texosquery@lastthreeoften#2% }% % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@twodigitsexactly} %\changes{1.2}{2017-03-23}{new} %Exactly two digits. % \begin{macrocode} \def\@texosquery@twodigitsexactly#1{% \@texosquery@twodigits@exactly#1\@texosquery@twodigits@exactly }% % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@twodigits@exactly} %\changes{1.2}{2017-03-23}{new} %Exactly two digits. % \begin{macrocode} \def\@texosquery@twodigits@exactly#1#2\@texosquery@twodigits@exactly{% \@texosquery@fmtsign{#1}% \@texosquery@lasttwooften#2% }% % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fmt@dtf} %\changes{1.2}{2017-03-23}{new} %\begin{definition} %\cs{@texosquery@fmt@dtf}\marg{n}\marg{designator} %\end{definition} % %When formatting a date-time pattern \cs{texosquerydtf} will %temporarily be redefined to this command. This command indicates %the format obtained by \meta{n} instances of \meta{designator}. %For example, \verb|{2}{M}| indicates the format \texttt{MM}. This %command tests for \cs{texosqueryfmtpat}\meta{format}, which should %take a single argument. If defined, that's used, otherwise use one %of the numeric commands defined above. The \sty{tex-locale} package %defines \cs{texosqueryfmtpatMMM} and so on to use the locale's month names %etc. %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fmt@dtf#1#2{% \@texosquery@ifundef{@texosquery@fmt@#2}% {\@texosquery@warn{Unknown date-time pattern designator `#2'}}% {% \ifcase#1 \or \@texosquery@ifundef{texosqueryfmtpat#2}% {% \expandafter\expandafter\expandafter \@texosquery@atleastonedigit \expandafter\expandafter\expandafter {\csname @texosquery@fmt@#2\endcsname}% }% {% \csname texosqueryfmtpat#2\expandafter\expandafter\expandafter\endcsname \expandafter\expandafter\expandafter {\csname @texosquery@fmt@#2\endcsname}% }% \or \@texosquery@ifundef{texosqueryfmtpat#2#2}% {% \expandafter\expandafter\expandafter \@texosquery@twodigitsexactly \expandafter\expandafter\expandafter {\csname @texosquery@fmt@#2\endcsname}% }% {% \csname texosqueryfmtpat#2#2\expandafter\expandafter\expandafter \endcsname \expandafter\expandafter\expandafter {\csname @texosquery@fmt@#2\endcsname}% }% \or \@texosquery@ifundef{texosqueryfmtpat#2#2#2}% {% \expandafter\expandafter\expandafter \@texosquery@threedigitsexactly \expandafter\expandafter\expandafter {\csname @texosquery@fmt@#2\endcsname}% }% {% \csname texosqueryfmtpat#2#2#2\expandafter\expandafter\expandafter \endcsname \expandafter\expandafter\expandafter {\csname @texosquery@fmt@#2\endcsname}% }% \else \@texosquery@ifundef{texosqueryfmtpat#2#2#2#2}% {% \expandafter\expandafter\expandafter \@texosquery@atleastfourdigits \expandafter\expandafter\expandafter {\csname @texosquery@fmt@#2\endcsname}% }% {% \csname texosqueryfmtpat#2#2#2#2\expandafter\expandafter\expandafter \endcsname \expandafter\expandafter\expandafter {\csname @texosquery@fmt@#2\endcsname}% }% \fi }% } % \end{macrocode} %\end{macro} % %Provide default commands for the time zone designators, since the %time zone isn't supplied as a single integer. % %\begin{macro}{\texosqueryfmttimezonehr} %\changes{1.2}{2017-03-23}{new} %Allow for \verb|-0| so append 1 to hour in test. % \begin{macrocode} \def\texosqueryfmttimezonehr#1{% \ifnum#11<0\@texosquery@fmtminus \ifnum#1>-10 0\fi\number-#1 \else +\ifnum#1<10 0\fi\number#1 \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmttimezonenumhr} %\changes{1.2}{2017-03-23}{new} %Like the above, but don't zero-pad or prefix with plus sign. % \begin{macrocode} \def\texosqueryfmttimezonenumhr#1{% \ifnum#11<0\@texosquery@fmtminus \number-#1 \else \number#1 \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmttimezonemin} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosqueryfmttimezonemin#1{% \ifnum#1<10 0\fi\number#1 } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@firstoffour} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@firstoffour#1#2#3#4{#1} % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@secondoffour} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@secondoffour#1#2#3#4{#2} % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@thirdoffour} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@thirdoffour#1#2#3#4{#3} % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@fourthoffour} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@fourthoffour#1#2#3#4{#4} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryshorttimezone} %\changes{1.2}{2017-03-23}{new} %Maps id to short time zone display name. This will need redefining %as appropriate. The default simply expands to the ID. %Mappings can be obtained for a particular locale using the %\shortarg{Z} or \longarg{time-zones} action. % \begin{macrocode} \def\texosqueryshorttimezone#1{#1} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryshortdstzone} %\changes{1.2}{2017-03-23}{new} %Maps id to short daylight saving time zone display name. This will need redefining %as appropriate. The default simply expands to the ID followed by %(DST). % \begin{macrocode} \def\texosqueryshortdstzone#1{#1 (DST)} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerylongtimezone} %\changes{1.2}{2017-03-23}{new} %Maps id to long time zone display name. This will need redefining %as appropriate. The default simply expands to the ID. % \begin{macrocode} \def\texosquerylongtimezone#1{#1} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerylongdstzone} %\changes{1.2}{2017-03-23}{new} %Maps id to long daylight saving time zone display name. This will need redefining %as appropriate. The default simply expands to the ID followed by %(DST). % \begin{macrocode} \def\texosquerylongdstzone#1{#1 (DST)} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerytimesep} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerytimesep{:} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatz} %\changes{1.2}{2017-03-23}{new} %Default time zone format for \texttt{z} designator. % \begin{macrocode} \def\texosqueryfmtpatz#1{% \expandafter\ifnum\@texosquery@fourthoffour#1=0 \expandafter\texosqueryshorttimezone\expandafter{\@texosquery@thirdoffour#1}% \else \expandafter\texosqueryshortdstzone\expandafter{\@texosquery@thirdoffour#1}% \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatzz} %\changes{1.2}{2017-03-23}{new} %Default time zone format for \texttt{zz} designator. % \begin{macrocode} \def\texosqueryfmtpatzz#1{% \expandafter\ifnum\@texosquery@fourthoffour#1=0 \expandafter\texosqueryshorttimezone\expandafter{\@texosquery@thirdoffour#1}% \else \expandafter\texosqueryshortdstzone\expandafter{\@texosquery@thirdoffour#1}% \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatzzz} %\changes{1.2}{2017-03-23}{new} %Default time zone format for \texttt{zzz} designator. % \begin{macrocode} \def\texosqueryfmtpatzzz#1{% \expandafter\ifnum\@texosquery@fourthoffour#1=0 \expandafter\texosquerylongtimezone\expandafter{\@texosquery@thirdoffour#1}% \else \expandafter\texosquerylongdstzone\expandafter{\@texosquery@thirdoffour#1}% \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatzzzz} %\changes{1.2}{2017-03-23}{new} %Default time zone format for \texttt{zzzz} designator. % \begin{macrocode} \def\texosqueryfmtpatzzzz#1{% \expandafter\ifnum\@texosquery@fourthoffour#1=0 \expandafter\texosquerylongtimezone\expandafter{\@texosquery@thirdoffour#1}% \else \expandafter\texosquerylongdstzone\expandafter{\@texosquery@thirdoffour#1}% \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatZ} %\changes{1.2}{2017-03-23}{new} %Default time zone format for \texttt{Z} designator. % \begin{macrocode} \def\texosqueryfmtpatZ#1{% \expandafter\texosqueryfmttimezonehr\expandafter {\@texosquery@firstoffour#1}% \expandafter\texosqueryfmttimezonemin\expandafter {\@texosquery@secondoffour#1}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatZZ} %\changes{1.2}{2017-03-23}{new} %Default time zone format for \texttt{ZZ} designator. % \begin{macrocode} \def\texosqueryfmtpatZZ#1{% \expandafter\texosqueryfmttimezonehr\expandafter {\@texosquery@firstoffour#1}% \expandafter\texosqueryfmttimezonemin\expandafter {\@texosquery@secondoffour#1}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatZZZ} %\changes{1.2}{2017-03-23}{new} %Default time zone format for \texttt{ZZZ} designator. % \begin{macrocode} \def\texosqueryfmtpatZZZ#1{% \expandafter\texosqueryfmttimezonehr\expandafter {\@texosquery@firstoffour#1}% \expandafter\texosqueryfmttimezonemin\expandafter {\@texosquery@secondoffour#1}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatZZZZ} %\changes{1.2}{2017-03-23}{new} %Default time zone format for \texttt{ZZZZ} designator. % \begin{macrocode} \def\texosqueryfmtpatZZZZ#1{% \expandafter\texosqueryfmttimezonehr\expandafter {\@texosquery@firstoffour#1}% \expandafter\texosqueryfmttimezonemin\expandafter {\@texosquery@secondoffour#1}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatX} %\changes{1.2}{2017-03-23}{new} %Default time zone format for \texttt{X} designator. % \begin{macrocode} \def\texosqueryfmtpatX#1{% \expandafter\texosqueryfmttimezonehr\expandafter {\@texosquery@firstoffour#1}% \texosquerytimesep \expandafter\texosqueryfmttimezonemin\expandafter {\@texosquery@secondoffour#1}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatXX} %\changes{1.2}{2017-03-23}{new} %Default time zone format for \texttt{XX} designator. % \begin{macrocode} \def\texosqueryfmtpatXX#1{% \expandafter\texosqueryfmttimezonehr\expandafter {\@texosquery@firstoffour#1}% \texosquerytimesep \expandafter\texosqueryfmttimezonemin\expandafter {\@texosquery@secondoffour#1}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatXXX} %\changes{1.2}{2017-03-23}{new} %Default time zone format for \texttt{XXX} designator. % \begin{macrocode} \def\texosqueryfmtpatXXX#1{% \expandafter\texosqueryfmttimezonehr\expandafter {\@texosquery@firstoffour#1}% \texosquerytimesep \expandafter\texosqueryfmttimezonemin\expandafter {\@texosquery@secondoffour#1}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatXXXX} %\changes{1.2}{2017-03-23}{new} %Default time zone format for \texttt{XXXX} designator. % \begin{macrocode} \def\texosqueryfmtpatXXXX#1{% \expandafter\texosqueryfmttimezonehr\expandafter {\@texosquery@firstoffour#1}% \texosquerytimesep \expandafter\texosqueryfmttimezonemin\expandafter {\@texosquery@secondoffour#1}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpata} %\changes{1.2}{2017-03-23}{new} %Default am/pm designator for the \texttt{a} designator. % \begin{macrocode} \def\texosqueryfmtpata#1{% \ifnum#1=0 AM\else PM\fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpataa} %\changes{1.2}{2017-03-23}{new} %Default am/pm for the \texttt{aa} designator. Just make it the same %as the \texttt{a} designator. % \begin{macrocode} \def\texosqueryfmtpataa{\texosqueryfmtpata} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpataaa} %\changes{1.2}{2017-03-23}{new} %Default am/pm for the \texttt{aaa} designator. Just make it the same %as the \texttt{a} designator. % \begin{macrocode} \def\texosqueryfmtpataaa{\texosqueryfmtpata} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpataaaa} %\changes{1.2}{2017-03-23}{new} %Default am/pm for the \texttt{aaaa} designator. Just make it the same %as the \texttt{a} designator. % \begin{macrocode} \def\texosqueryfmtpataaaa{\texosqueryfmtpata} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatG} %\changes{1.2}{2017-03-23}{new} %Default era designator for the \texttt{G} designator. % \begin{macrocode} \def\texosqueryfmtpatG#1{% \ifnum#1=1 AD\else BC\fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatGG} %\changes{1.2}{2017-03-23}{new} %Default era for the \texttt{GG} designator. Just make it the same %as the \texttt{G} designator. % \begin{macrocode} \def\texosqueryfmtpatGG{\texosqueryfmtpatG} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatGGG} %\changes{1.2}{2017-03-23}{new} %Default era for the \texttt{GGG} designator. Just make it the same %as the \texttt{G} designator. % \begin{macrocode} \def\texosqueryfmtpatGGG{\texosqueryfmtpatG} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosqueryfmtpatGGGG} %\changes{1.2}{2017-03-23}{new} %Default era for the \texttt{GGGG} designator. Just make it the same %as the \texttt{G} designator. % \begin{macrocode} \def\texosqueryfmtpatGGGG{\texosqueryfmtpatG} % \end{macrocode} %\end{macro} % % %\subsubsection{Applying Numeric Patterns} %\label{sec:applynumpatterns} % %\begin{macro}{\texosqueryfmtnumber} %\changes{1.2}{2017-03-23}{new} %\begin{definition} %\cs{texosqueryfmtnumber}\marg{pattern}\marg{int}\marg{frac}\marg{mantissa} %\end{definition} %General purpose low-level number formatting command. The first argument %\meta{pattern} is the pattern. The other arguments are unformatted integers %and must be present and not exceed 10 digits each. The \meta{frac} part must %not start with a sign. The minus sign should go at the start of %\meta{int} for negative numbers. The plus sign is %optional for positive \meta{int} or \meta{mantissa} and not %permitted in \meta{frac}. The arguments may each be the actual numerical %value or be a single control sequence whose replacement text is %the value. Avoid anything more complicated than that. % %This package doesn't provide a higher level command that can split a number %into integer, fractional and mantissa parts. % \begin{macrocode} \def\texosqueryfmtnumber#1#2#3#4{% \begingroup \let\texosquerypatstr\texosquerypatfmtstr \let\texosquerypatquote\texosquerypatfmtquote \let\texosquerypatplusminus\texosquerypatfmt@plusminus \let\texosquerypatnum\texosquerypatfmt@num \let\texosquerypatsinum\texosquerypatfmt@sinum \let\texosquerypatdec\texosquerypatfmt@dec \let\texosquerypatprefixcurrency\texosquery@patfmt@prefixcurrency \let\texosquerypatprefixicurrency\texosquery@patfmt@prefixicurrency \let\texosquerypatsuffixcurrency\texosquery@patfmt@suffixcurrency \let\texosquerypatsuffixicurrency\texosquery@patfmt@suffixicurrency \let\texosquerypatdigit\texosquerypatfmt@digit \let\texosquerypatdigitnozero\texosquerypatfmt@digitnozero \let\texosquerypatgroupsep\texosquerypatfmt@groupsep \let\texosquerypatprefixpercent\texosquery@patfmt@prefixpercent \let\texosquerypatsuffixpercent\texosquery@patfmt@suffixpercent \let\texosquerypatprefixpermill\texosquery@patfmt@prefixpermill \let\texosquerypatsuffixpermill\texosquery@patfmt@suffixpermill \let\texosquerypatminus\@texosquerypat@numfmt@sign \let\texosquerypatfmt@decsep\texosquerypatfmtdecsep % \end{macrocode} %Allow for negative zero in the \meta{int} part. To avoid overflow, %first check for 0 and then append 1 to the number to %catch \verb|-0|. % \begin{macrocode} \edef\@texosquery@sgn{% \ifnum#2=0 \expandafter\ifnum#21<0 -\else+\fi \else \ifnum#2<0 -\else+\fi \fi }% % \end{macrocode} %Allow for arguments passed as control sequences that expand to a %number. % \begin{macrocode} \edef\@texosquery@int{\expandafter\@texosquery@paddigits \expandafter{\number#2}}% \let\@texosquery@si@int\@texosquery@int % \end{macrocode} %Can't use \cs{number} here as we'll lose any leading zeros. % \begin{macrocode} \edef\@texosquery@frac{\expandafter\@texosquery@paddigits@trailing \expandafter{#3}}% \let\@texosquery@si@frac\@texosquery@frac \edef\@texosquery@mantissa{\expandafter\@texosquery@paddigits \expandafter{\number#4}}% % \end{macrocode} %Is the mantissa non-zero? % \begin{macrocode} \ifnum#4=0\relax \else \expandafter\ifx\@texosquery@sgn-% \edef\@texosquery@int{\expandafter \@texosquery@paddigits@pos\expandafter{\number-#2}}% \else \edef\@texosquery@int{\@texosquery@paddigits@pos{#2}}% \fi % \end{macrocode} %Shift. % \begin{macrocode} \ifnum#4<0 \expandafter\@texosquery@neg@shift\expandafter{\number-#4}% \else \@texosquery@pos@shift{#4}% \fi \expandafter\ifx\@texosquery@sgn-% \edef\@texosquery@int{\expandafter\@texosquery@paddigits \expandafter{\number-\@texosquery@int}}% \else \edef\@texosquery@int{\expandafter\@texosquery@paddigits \expandafter{\number\@texosquery@int}}% \fi \edef\@texosquery@frac{\@texosquery@paddigits@trailing{\@texosquery@frac}}% \fi \edef\@texosquery@current{\expandafter\@texosquery@gobble\@texosquery@int}% \let\@texosquery@zerodigit\@texosquery@zerodigit@leading \expandafter\ifx\@texosquery@sgn-% \let\@texosquery@currentsign\texosquerypatfmtminus \else \let\@texosquery@currentsign\texosquerypatfmtplus \fi \@texosquery@digitindex=0\relax \let\@texosquery@patfmt@dosep\empty \@texosquery@digitfoundfalse #1% \endgroup } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@digitindex} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \newcount\@texosquery@digitindex % \end{macrocode} %\end{macro} % %\begin{macro}{\if@texosquery@digitfound} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \newif\if@texosquery@digitfound % \end{macrocode} %\end{macro} % %Macros to shift the decimal place. %\begin{macro}{\@texosquery@pos@shift} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@pos@shift#1{% \ifcase#1 \or \edef\@texosquery@int{% \expandafter\@texosquery@lastnineoften\@texosquery@int \expandafter\@texosquery@firstoften\@texosquery@frac}% \edef\@texosquery@frac{% \expandafter\@texosquery@lastnineoften\@texosquery@frac }% \or \edef\@texosquery@int{% \expandafter\@texosquery@lasteightoften\@texosquery@int \expandafter\@texosquery@firsttwooften\@texosquery@frac}% \edef\@texosquery@frac{% \expandafter\@texosquery@lasteightoften\@texosquery@frac }% \or \edef\@texosquery@int{% \expandafter\@texosquery@lastsevenoften\@texosquery@int \expandafter\@texosquery@firstthreeoften\@texosquery@frac}% \edef\@texosquery@frac{% \expandafter\@texosquery@lastsevenoften\@texosquery@frac }% \or \edef\@texosquery@int{% \expandafter\@texosquery@lastsixoften\@texosquery@int \expandafter\@texosquery@firstfouroften\@texosquery@frac}% \edef\@texosquery@frac{% \expandafter\@texosquery@lastsixoften\@texosquery@frac }% \or \edef\@texosquery@int{% \expandafter\@texosquery@lastfiveoften\@texosquery@int \expandafter\@texosquery@firstfiveoften\@texosquery@frac}% \edef\@texosquery@frac{% \expandafter\@texosquery@lastfiveoften\@texosquery@frac }% \or \edef\@texosquery@int{% \expandafter\@texosquery@lastfouroften\@texosquery@int \expandafter\@texosquery@firstsixoften\@texosquery@frac}% \edef\@texosquery@frac{% \expandafter\@texosquery@lastfouroften\@texosquery@frac }% \or \edef\@texosquery@int{% \expandafter\@texosquery@lastthreeoften\@texosquery@int \expandafter\@texosquery@firstsevenoften\@texosquery@frac}% \edef\@texosquery@frac{% \expandafter\@texosquery@lastthreeoften\@texosquery@frac }% \or \edef\@texosquery@int{% \expandafter\@texosquery@lasttwooften\@texosquery@int \expandafter\@texosquery@firsteightoften\@texosquery@frac}% \edef\@texosquery@frac{% \expandafter\@texosquery@lasttwooften\@texosquery@frac }% \or \edef\@texosquery@int{% \expandafter\@texosquery@tenthoften\@texosquery@int \expandafter\@texosquery@firstnineoften\@texosquery@frac}% \edef\@texosquery@frac{% \expandafter\@texosquery@tenthoften\@texosquery@frac }% \or \let\@texosquery@int\@texosquery@frac \edef\@texosquery@frac{0}% % \end{macrocode} %Anything larger will require scientific notation. Hopefully the %pattern supports this. % \begin{macrocode} \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@neg@shift} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@neg@shift#1{% \ifcase#1 \or \edef\@texosquery@frac{% \expandafter\@texosquery@lastoneoften\@texosquery@int \expandafter\@texosquery@firstnineoften\@texosquery@frac }% \edef\@texosquery@int{% \expandafter\@texosquery@firstnineoften\@texosquery@int }% \or \edef\@texosquery@frac{% \expandafter\@texosquery@lasttwooften\@texosquery@int \expandafter\@texosquery@firsteightoften\@texosquery@frac }% \edef\@texosquery@int{% \expandafter\@texosquery@firsteightoften\@texosquery@int }% \or \edef\@texosquery@frac{% \expandafter\@texosquery@lastthreeoften\@texosquery@int \expandafter\@texosquery@firstsevenoften\@texosquery@frac }% \edef\@texosquery@int{% \expandafter\@texosquery@firstsevenoften\@texosquery@int }% \or \edef\@texosquery@frac{% \expandafter\@texosquery@lastfouroften\@texosquery@int \expandafter\@texosquery@firstsixoften\@texosquery@frac }% \edef\@texosquery@int{% \expandafter\@texosquery@firstsixoften\@texosquery@int }% \or \edef\@texosquery@frac{% \expandafter\@texosquery@lastfiveoften\@texosquery@int \expandafter\@texosquery@firstfiveoften\@texosquery@frac }% \edef\@texosquery@int{% \expandafter\@texosquery@firstfiveoften\@texosquery@int }% \or \edef\@texosquery@frac{% \expandafter\@texosquery@lastsixoften\@texosquery@int \expandafter\@texosquery@firstfouroften\@texosquery@frac }% \edef\@texosquery@int{% \expandafter\@texosquery@firstfouroften\@texosquery@int }% \or \edef\@texosquery@frac{% \expandafter\@texosquery@lastsevenoften\@texosquery@int \expandafter\@texosquery@firstthreeoften\@texosquery@frac }% \edef\@texosquery@int{% \expandafter\@texosquery@firstthreeoften\@texosquery@int }% \or \edef\@texosquery@frac{% \expandafter\@texosquery@lasteightoften\@texosquery@int \expandafter\@texosquery@firsttwooften\@texosquery@frac }% \edef\@texosquery@int{% \expandafter\@texosquery@firsttwooften\@texosquery@int }% \or \edef\@texosquery@frac{% \expandafter\@texosquery@lastnineoften\@texosquery@int \expandafter\@texosquery@firstoften\@texosquery@frac }% \edef\@texosquery@int{% \expandafter\@texosquery@firstoften\@texosquery@int }% \or \edef\@texosquery@frac{\@texosquery@int\@texosquery@frac}% \edef\@texosquery@int{0}% % \end{macrocode} %Anything beyond this will require scientific notation. Hopefully the %pattern supports it. % \begin{macrocode} \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquerypat@numfmt@sign} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquerypat@numfmt@sign{% \@texosquery@currentsign \let\@texosquery@currentsign\empty } % \end{macrocode} %\end{macro} % % %\begin{macro}{\texosquerypatfmtstr} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatfmtstr#1{#1} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatfmtquote} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatfmtquote{'} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatfmt@plusminus} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatfmt@plusminus#1#2{% \edef\@texosquery@current{\expandafter\@texosquery@gobble\@texosquery@int}% \@texosquery@digitindex=0\relax \let\@texosquery@patfmt@dosep\empty \@texosquery@digitfoundfalse \expandafter\ifx\@texosquery@sgn-% #2% \ifnum\@texosquery@digitindex=10 \else \@texosquery@invalidpattern{#2}% \fi \else #1% \ifnum\@texosquery@digitindex=10 \else \@texosquery@invalidpattern{#1}% \fi \fi } % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatfmt@num} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatfmt@num#1{#1} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatfmtexp} %\changes{1.2}{2017-03-23}{new} %Exponent symbol. Change as appropriate. % \begin{macrocode} \def\texosquerypatfmtexp{E} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerypatfmt@sinum} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatfmt@sinum#1#2{% \let\@texosquery@int\@texosquery@si@int \let\@texosquery@frac\@texosquery@si@frac \let\@texosquery@current\@texosquery@int #1% \texosquerypatfmtexp {\let\@texosquery@zerodigit\@texosquery@zerodigit@leading \ifnum\@texosquery@mantissa<0\relax \let\@texosquery@currentsign\texosquerypatfmtminus \else \let\@texosquery@currentsign\texosquerypatfmtplus \fi \edef\@texosquery@current{\expandafter\@texosquery@gobble\@texosquery@mantissa}% \@texosquery@digitindex=0\relax \let\@texosquery@patfmt@dosep\empty \@texosquery@digitfoundfalse #2}} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatfmtdecsep} %\changes{1.2}{2017-03-23}{new} %Decimal separator. Change as appropriate. % \begin{macrocode} \def\texosquerypatfmtdecsep{.} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerypatfmtcurdecsep} %\changes{1.2}{2017-03-23}{new} %Currency decimal separator. Change as appropriate. % \begin{macrocode} \def\texosquerypatfmtcurdecsep{.} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerypatfmt@dec} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatfmt@dec#1#2{% \edef\@texosquery@current{\expandafter\@texosquery@gobble\@texosquery@int}% \@texosquery@digitindex=0\relax \let\@texosquery@patfmt@dosep\empty \@texosquery@digitfoundfalse \let\@texosquery@zerodigit\@texosquery@zerodigit@leading #1% \ifnum\@texosquery@digitindex=10 \else \@texosquery@invalidpattern{#1}% \fi % \end{macrocode} %\changes{1.2.1}{2017-03-28}{moved decimal sep} %We can't display the decimal separator just yet as the pattern may %not show any digits for the fractional part. So only do the %separator just before the first digit. % \begin{macrocode} \let\@texosquery@patfmt@dosep\texosquerypatfmt@decsep \let\@texosquery@current\@texosquery@frac \@texosquery@digitindex=0\relax \@texosquery@digitfoundfalse \let\@texosquery@zerodigit\@texosquery@zerodigit@trailing \let\@texosquery@currentsign\empty #2% \ifnum\@texosquery@digitindex=10 \else \@texosquery@invalidpattern{#2}% \fi } % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatfmtint} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatfmtint#1{% \edef\@texosquery@current{\expandafter\@texosquery@gobble\@texosquery@int}% \@texosquery@digitindex=0\relax \@texosquery@digitfoundfalse \let\@texosquery@zerodigit\@texosquery@zerodigit@leading #1% \ifnum\@texosquery@digitindex=10 \else \@texosquery@invalidpattern{#1}% \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@setpatdisplay} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@setpatdisplay{% \def\texosquerypatstr##1{'##1'}% \def\texosquerypatquote{''}% \def\texosquerypatplusminus##1##2{##1;##2}% \def\texosquerypatnum##1{##1}% \def\texosquerypatsinum##1##2{##1E##2}% \def\texosquerypatdec##1##2{##1.##2}% \def\texosquerypatprefixcurrency##1##2{##2¤##1}% \def\texosquerypatprefixicurrency##1##2{##2¤¤##1}% \def\texosquerypatsuffixcurrency##1##2{##1¤##2}% \def\texosquerypatsuffixicurrency##1##2{##1¤¤##2}% \def\texosquerypatdigit{0}% \def\texosquerypatdigitnozero{\#}% \def\texosquerypatminus{-}% \def\texosquerypatgroupsep{,}% \def\texosquerypatprefixpercent##1##2{##2\%##1}% \def\texosquerypatsuffixpercent##1##2{##1\%##2}% \def\texosquerypatprefixpermill##1##2{##2‰##1}% \def\texosquerypatsuffixpermill##1##2{##1‰##2}% \def\texosquerypatfmt@decsep{.}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@invalidpattern} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@invalidpattern#1{% \begingroup \@texosquery@setpatdisplay \@texosquery@err{10 digit specifiers expected in numeric pattern #1. Found \number\@texosquery@digitindex}% {Each integer element of a numeric pattern must have exactly 10 digit specifiers (0 or \#)}% \endgroup } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerypatfmtcurrencysign} %\changes{1.2}{2017-03-23}{new} %Currency symbol. Redefine as appropriate. % \begin{macrocode} \def\texosquerypatfmtcurrencysign{\$} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerypatfmticurrencysign} %\changes{1.2}{2017-03-23}{new} %International currency symbol. There's no generic fallback that's %independent of the input encoding, so this uses a UTF-8 character %on the assumption that if \cs{textcurrency} isn't available (for %example, through \sty{textcomp}, then the user may be using \XeTeX\ %or \LuaTeX). If this isn't the case, and there's no UTF-8 support, %then this command will need to be redefined as appropriate. % \begin{macrocode} \ifx\textcurrency\undefined \def\texosquerypatfmticurrencysign{¤} \else \def\texosquerypatfmticurrencysign{\textcurrency} \fi % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquery@patfmt@prefixcurrency} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquery@patfmt@prefixcurrency#1#2{% \let\texosquerypatfmt@decsep\texosquerypatfmtcurdecsep #2\texosquerypatfmtcurrencysign#1% } % \end{macrocode} %\end{macro} %\begin{macro}{\texosquery@patfmt@prefixicurrency} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquery@patfmt@prefixicurrency#1#2{% \let\texosquerypatfmt@decsep\texosquerypatfmtcurdecsep #2\texosquerypatfmticurrencysign#1% } % \end{macrocode} %\end{macro} %\begin{macro}{\texosquery@patfmt@suffixcurrency} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquery@patfmt@suffixcurrency#1#2{% \let\texosquerypatfmt@decsep\texosquerypatfmtcurdecsep #1\texosquerypatfmtcurrencysign#2% } % \end{macrocode} %\end{macro} %\begin{macro}{\texosquery@patfmt@suffixicurrency} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquery@patfmt@suffixicurrency#1#2{% \let\texosquerypatfmt@decsep\texosquerypatfmtcurdecsep #1\texosquerypatfmticurrencysign#2% } % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatfmt@digit} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatfmt@digit{% \advance\@texosquery@digitindex by 1\relax \if@texosquery@digitfound \else \ifx\@texosquery@currentsign\texosquerypatfmtminus \texosquerypatfmtminus \let\@texosquery@currentsign\empty \else \@texosquery@patfmt@dosep \let\@texosquery@patfmt@dosep\empty \fi \fi \@texosquery@digitfoundtrue \ifcase\@texosquery@digitindex \or \expandafter\@texosquery@firstoften\@texosquery@current \or \expandafter\@texosquery@secondoften\@texosquery@current \or \expandafter\@texosquery@thirdoften\@texosquery@current \or \expandafter\@texosquery@fourthoften\@texosquery@current \or \expandafter\@texosquery@fifthoften\@texosquery@current \or \expandafter\@texosquery@sixthoften\@texosquery@current \or \expandafter\@texosquery@seventhoften\@texosquery@current \or \expandafter\@texosquery@eighthoften\@texosquery@current \or \expandafter\@texosquery@ninthoften\@texosquery@current \or \expandafter\@texosquery@tenthoften\@texosquery@current \fi } % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatfmt@digitnozero} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatfmt@digitnozero{% \advance\@texosquery@digitindex by 1\relax \edef\@texosquery@digit{% \ifcase\@texosquery@digitindex 0% \or \expandafter\@texosquery@firstoften\@texosquery@current \or \expandafter\@texosquery@secondoften\@texosquery@current \or \expandafter\@texosquery@thirdoften\@texosquery@current \or \expandafter\@texosquery@fourthoften\@texosquery@current \or \expandafter\@texosquery@fifthoften\@texosquery@current \or \expandafter\@texosquery@sixthoften\@texosquery@current \or \expandafter\@texosquery@seventhoften\@texosquery@current \or \expandafter\@texosquery@eighthoften\@texosquery@current \or \expandafter\@texosquery@ninthoften\@texosquery@current \or \expandafter\@texosquery@tenthoften\@texosquery@current \else 0% \fi }% \ifnum\@texosquery@digit=0\relax \@texosquery@zerodigit \else \if@texosquery@digitfound \else \ifx\@texosquery@currentsign\texosquerypatfmtminus \texosquerypatfmtminus \let\@texosquery@currentsign\empty \else \@texosquery@patfmt@dosep \let\@texosquery@patfmt@dosep\empty \fi \fi \@texosquery@digitfoundtrue \@texosquery@digit \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@zerodigit@leading} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@zerodigit@leading{% \edef\@texosquery@digit{% \ifcase\@texosquery@digitindex 0% \or \expandafter\@texosquery@firstoften\@texosquery@current \or \expandafter\@texosquery@firsttwooften\@texosquery@current \or \expandafter\@texosquery@firstthreeoften\@texosquery@current \or \expandafter\@texosquery@firstfouroften\@texosquery@current \or \expandafter\@texosquery@firstfiveoften\@texosquery@current \or \expandafter\@texosquery@firstsixoften\@texosquery@current \or \expandafter\@texosquery@firstsevenoften\@texosquery@current \or \expandafter\@texosquery@firsteightoften\@texosquery@current \or \expandafter\@texosquery@firstnineoften\@texosquery@current \or \@texosquery@current \else 0% \fi }% \ifnum\@texosquery@digit>0\relax \if@texosquery@digitfound \else \ifx\texosquerypatminus\texosquerypatfmtminus \texosquerypatfmtminus \else \@texosquery@patfmt@dosep \let\@texosquery@patfmt@dosep\empty \fi \fi \@texosquery@digitfoundtrue 0% \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@zerodigit@trailing} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@zerodigit@trailing{% \edef\@texosquery@digit{% \ifcase\@texosquery@digitindex 0% \or \@texosquery@current \or \expandafter\@texosquery@lastnineoften\@texosquery@current \or \expandafter\@texosquery@lasteightoften\@texosquery@current \or \expandafter\@texosquery@lastsevenoften\@texosquery@current \or \expandafter\@texosquery@lastsixoften\@texosquery@current \or \expandafter\@texosquery@lastfiveoften\@texosquery@current \or \expandafter\@texosquery@lastfouroften\@texosquery@current \or \expandafter\@texosquery@lastthreeoften\@texosquery@current \or \expandafter\@texosquery@lasttwooften\@texosquery@current \or \expandafter\@texosquery@tenthoften\@texosquery@current \else 0% \fi }% \ifnum\@texosquery@digit>0\relax \if@texosquery@digitfound \else \ifx\texosquerypatminus\texosquerypatfmtminus \texosquerypatfmtminus \else \@texosquery@patfmt@dosep \let\@texosquery@patfmt@dosep\empty \fi \fi \@texosquery@digitfoundtrue 0% \fi } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerypatfmtminus} %\changes{1.2}{2017-03-23}{new} %Formatted minus sign. Redefined as appropriate. % \begin{macrocode} \def\texosquerypatfmtminus{\ifmmode-\else$-$\fi} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatfmtplus} %\changes{1.2}{2017-03-23}{new} %Formatted plus sign. Redefined as appropriate. % \begin{macrocode} \def\texosquerypatfmtplus{\ifmmode+\else$+$\fi} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatfmtgroupsep} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatfmtgroupsep{,} % \end{macrocode} %\end{macro} %\begin{macro}{\texosquerypatfmt@groupsep} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquerypatfmt@groupsep{% \if@texosquery@digitfound\texosquerypatfmtgroupsep\fi} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerypatfmtpercentsign} %\changes{1.2}{2017-03-23}{new} %Percent sign used in number format. % \begin{macrocode} \def\texosquerypatfmtpercentsign{\%} % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquerypatfmtpermillsign} %\changes{1.2}{2017-03-23}{new} %Per-mill sign used in number format. Redefine as appropriate. % \begin{macrocode} \def\texosquerypatfmtpermillsign{‰} % \end{macrocode} %\end{macro} % %\begin{macro}{\@texosquery@adjust@per} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\@texosquery@adjust@per#1{% \@texosquery@pos@shift{#1}% \edef\@texosquery@int{\expandafter\@texosquery@paddigits \expandafter{\number\@texosquery@int}}% \edef\@texosquery@frac{\@texosquery@paddigits@trailing{\@texosquery@frac}}% \edef\@texosquery@current{\expandafter\@texosquery@gobble\@texosquery@int}% } % \end{macrocode} %\end{macro} % %\begin{macro}{\texosquery@patfmt@prefixpercent} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquery@patfmt@prefixpercent#1#2{% \@texosquery@adjust@per{2}% #2\texosquerypatfmtpercentsign#1% } % \end{macrocode} %\end{macro} %\begin{macro}{\texosquery@patfmt@suffixpercent} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquery@patfmt@suffixpercent#1#2{% \@texosquery@adjust@per{2}% #1\texosquerypatfmtpercentsign#2% } % \end{macrocode} %\end{macro} %\begin{macro}{\texosquery@patfmt@prefixpermill} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquery@patfmt@prefixpermill#1#2{% \@texosquery@adjust@per{3}% #2\texosquerypatfmtpermillsign#1% } % \end{macrocode} %\end{macro} %\begin{macro}{\texosquery@patfmt@suffixpermill} %\changes{1.2}{2017-03-23}{new} % \begin{macrocode} \def\texosquery@patfmt@suffixpermill#1#2{% \@texosquery@adjust@per{3}% #1\texosquerypatfmtpermillsign#2% } % \end{macrocode} %\end{macro} % %All done. %Restore the category code of \texttt{@}: % \begin{macrocode} \@texosquery@restore@at % \end{macrocode} %\iffalse % \begin{macrocode} % % \end{macrocode} %\fi % %\subsection{\LaTeX\ Code} %This is just a simple wrapper for \file{texosquery.tex} %so that it can be loaded using \LaTeX's standard \cs{usepackage} %method. %\iffalse % \begin{macrocode} %<*texosquery.sty> % \end{macrocode} %\fi %Identify package: % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{texosquery}[2020/02/04 v1.7 (NLCT)] % \end{macrocode} %Load \file{texosquery.tex}: % \begin{macrocode} \input{texosquery} % \end{macrocode} %\iffalse % \begin{macrocode} % % \end{macrocode} %\fi % %\subsection{Configuration File (\file{texosquery.cfg})} %The configuration file. This will need to be edited as appropriate %to the system. Since Java 7 end of life has long passed, this %now defaults to Java 8. %\changes{1.7}{2020-02-04}{changed the default version to texosquery-jre8} %\iffalse % \begin{macrocode} %<*texosquery.cfg> % \end{macrocode} %\fi % \begin{macrocode} %< % \end{macrocode} %\fi %\subsection{Bash Scripts} %These are the bash scripts for Unix-like systems. %The first line %\begin{verbatim} %#!/bin/sh %\end{verbatim} %is added when the files are extracted by \file{texosquery.ins} %(since \verb|\nopreamble| automatically inserts a blank line at the %start of the file). %\iffalse % \begin{macrocode} %<*texosquery.sh> % \end{macrocode} %\fi %\subsubsection{\file{texosquery.sh}} %\changes{1.7}{2020-02-04}{changed bash scripts for improved cygwin support} %Adapted from tlcockpit.sh to ensure the script works with cygwin. % \begin{macrocode} scriptname=`basename "$0" .sh` jar="$scriptname.jar" jarpath=`kpsewhich --progname="$scriptname" --format=texmfscripts "$jar"` kernel=`uname -s 2>/dev/null` if echo "$kernel" | grep CYGWIN >/dev/null; then CYGWIN_ROOT=`cygpath -w /` export CYGWIN_ROOT jarpath=`cygpath -w "$jarpath"` fi java -jar "$jarpath" "$@" % \end{macrocode} %\iffalse % \begin{macrocode} % % \end{macrocode} %\fi % %\iffalse % \begin{macrocode} %<*texosquery-jre8.sh> % \end{macrocode} %\fi %\subsubsection{\file{texosquery-jre8.sh}} % \begin{macrocode} scriptname=`basename "$0" .sh` jar="$scriptname.jar" jarpath=`kpsewhich --progname="$scriptname" --format=texmfscripts "$jar"` kernel=`uname -s 2>/dev/null` if echo "$kernel" | grep CYGWIN >/dev/null; then CYGWIN_ROOT=`cygpath -w /` export CYGWIN_ROOT jarpath=`cygpath -w "$jarpath"` fi java -Djava.locale.providers=CLDR,JRE -jar "$jarpath" "$@" % \end{macrocode} %\iffalse % \begin{macrocode} % % \end{macrocode} %\fi % %\iffalse % \begin{macrocode} %<*texosquery-jre5.sh> % \end{macrocode} %\fi %\subsubsection{\file{texosquery-jre5.sh}} % \begin{macrocode} scriptname=`basename "$0" .sh` jar="$scriptname.jar" jarpath=`kpsewhich --progname="$scriptname" --format=texmfscripts "$jar"` kernel=`uname -s 2>/dev/null` if echo "$kernel" | grep CYGWIN >/dev/null; then CYGWIN_ROOT=`cygpath -w /` export CYGWIN_ROOT jarpath=`cygpath -w "$jarpath"` fi java -jar "$jarpath" "$@" % \end{macrocode} %\iffalse % \begin{macrocode} % % \end{macrocode} %\fi % %\subsection{Windows Batch Scripts} %These are the batch scripts for Windows. \TeX\ on Windows doesn't %allow the creation of \file{.bat} files, so \file{.ins} file %creates these with the extension \file{.batch} which will need to %be changed to \file{.bat} after extraction. %\iffalse % \begin{macrocode} %<*texosquery.bat> % \end{macrocode} %\fi %\subsubsection{\file{texosquery.bat}} % \begin{macrocode} @ECHO OFF FOR /F "tokens=*" %%I IN ('kpsewhich --progname=texosquery --format=texmfscripts texosquery.jar') DO SET JARPATH=%%I java -jar "%JARPATH%" %* % \end{macrocode} %\iffalse % \begin{macrocode} % % \end{macrocode} %\fi % %\iffalse % \begin{macrocode} %<*texosquery-jre8.bat> % \end{macrocode} %\fi %\subsubsection{\file{texosquery-jre8.bat}} % \begin{macrocode} @ECHO OFF FOR /F "tokens=*" %%I IN ('kpsewhich --progname=texosquery --format=texmfscripts texosquery-jre8.jar') DO SET JARPATH=%%I java -Djava.locale.providers=CLDR,JRE -jar "%JARPATH%" %* % \end{macrocode} %\iffalse % \begin{macrocode} % % \end{macrocode} %\fi % %\iffalse % \begin{macrocode} %<*texosquery-jre5.bat> % \end{macrocode} %\fi %\subsubsection{\file{texosquery-jre5.bat}} % \begin{macrocode} @ECHO OFF FOR /F "tokens=*" %%I IN ('kpsewhich --progname=texosquery --format=texmfscripts texosquery-jre5.jar') DO SET JARPATH=%%I java -jar "%JARPATH%" %* % \end{macrocode} %\iffalse % \begin{macrocode} % % \end{macrocode} %\fi % %\Finale \endinput