diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/datetime2/samples |
Initial commit
Diffstat (limited to 'macros/latex/contrib/datetime2/samples')
14 files changed, 513 insertions, 0 deletions
diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-babel.pdf b/macros/latex/contrib/datetime2/samples/datetime2-sample-babel.pdf Binary files differnew file mode 100644 index 0000000000..578625e683 --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-babel.pdf diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-babel.tex b/macros/latex/contrib/datetime2/samples/datetime2-sample-babel.tex new file mode 100644 index 0000000000..85c7dfadd4 --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-babel.tex @@ -0,0 +1,84 @@ +% This file is public domain. + +% This document requires the datetime2-english module to be +% installed (in addition to the datetime2 package). +% arara: pdflatex +\documentclass[british,american,australian,canadian,newzealand,en-GG,en-JE,en-IM,en-MT,en-IE]{article} + +\usepackage{babel} +\usepackage[datesep=/,showzoneminutes=false,useregional]{datetime2} +\usepackage[colorlinks]{hyperref} + +%\DTMlangsetup{mapzone=false} + +\DTMsavetimestamp{mydate}{2014-06-03T12:45:02+01:00} +\DTMsavetimestamp{mydate2}{2015-03-20T08:05:09+00:00} +\DTMsavetimestamp{mydate3}{2014-12-15T23:55:49-06:00} +\DTMsavetimestamp{mydate4}{2014-01-27T12:05:00+09:00} +\DTMsavetimestamp{mydate5}{2013-11-28T02:05:00+12:00} + +% This will clear the BST mapping when the regional styles are set. +% The en-GB (british) style will then set it to BST. +\renewcommand*{\DTMresetzones}{\DTMclearmap{01}{00}} + +\begin{document} +\tableofcontents + +% Define command to test each region +\newcommand{\testregion}[1]{% + \ifcsdef{date#1}{\selectlanguage{#1}}{\DTMsetstyle{#1}}% + + \section{#1} + + Today: \today. + + Now: \DTMnow. + + \subsection{\DTMuse{mydate}} + Saved Date (\texttt{mydate}): \DTMusedate{mydate} + Saved time (\texttt{mydate}): \DTMusetime{mydate}. + \typeout{Date (#1): \DTMusedate{mydate}} + + \subsection{\DTMuse{mydate2}} + Saved Date (\texttt{mydate2}): \DTMusedate{mydate2} + Saved time (\texttt{mydate2}): \DTMusetime{mydate2}. + \typeout{Date (#1): \DTMusedate{mydate2}} + + \subsection{\DTMuse{mydate3}} + Saved Date (\texttt{mydate3}): \DTMusedate{mydate3} + Saved time (\texttt{mydate3}): \DTMusetime{mydate3}. + \typeout{Date (#1): \DTMusedate{mydate3}} + + \subsection{\DTMuse{mydate4}} + Saved Date (\texttt{mydate4}): \DTMusedate{mydate4} + Saved time (\texttt{mydate4}): \DTMusetime{mydate4}. + \typeout{Date (#1): \DTMusedate{mydate4}} + + \subsection{\DTMuse{mydate5}} + Saved Date (\texttt{mydate5}): \DTMusedate{mydate5} + Saved time (\texttt{mydate5}): \DTMusetime{mydate5}. + \typeout{Date (#1): \DTMusedate{mydate5}} +} + +\testregion{british} + +\testregion{american} + +\testregion{australian} + +\testregion{canadian} + +\testregion{newzealand} + +% no official babel language for these regions as far as I can tell: +\testregion{en-GG} + +\testregion{en-JE} + +\testregion{en-IM} + +\testregion{en-MT} + +\testregion{en-IE} + +\end{document} diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-calc.pdf b/macros/latex/contrib/datetime2/samples/datetime2-sample-calc.pdf Binary files differnew file mode 100644 index 0000000000..02e2ba10da --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-calc.pdf diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-calc.tex b/macros/latex/contrib/datetime2/samples/datetime2-sample-calc.tex new file mode 100644 index 0000000000..decea34b1d --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-calc.tex @@ -0,0 +1,76 @@ +% This file is public domain. + +% arara: pdflatex +\documentclass{article} + +\usepackage[calc]{datetime2} + +\begin{document} + +\DTMsavejulianday{mydate}{2457023} +\DTMsavedate{mydate2}{2014-06-20} + +Date: \DTMusedate{mydate}. + +\newcount\myct +\DTMsaveddatetojulianday{mydate}{\myct} + +Julian day number: \number\myct. + +\DTMsaveddateoffsettojulianday{mydate}{2}{\myct} + +Julian day number (offset+2): \number\myct. + +Is \texttt{mydate2} (\DTMusedate{mydate2}) before +\texttt{mydate} (\DTMusedate{mydate})? +\DTMifdate + {mydate2} + {at most= + \DTMfetchyear{mydate}-\DTMfetchmonth{mydate}-\DTMfetchday{mydate}} + {yes}{no}. + +Is \texttt{mydate2} (\DTMusedate{mydate2}) after +\texttt{mydate} (\DTMusedate{mydate})? +\DTMifdate + {mydate2} + {at least= + \DTMfetchyear{mydate}-\DTMfetchmonth{mydate}-\DTMfetchday{mydate}} + {yes}{no}. + +\DTMsaveddatediff{mydate}{mydate2}{\myct} + +\DTMusedate{mydate} is +\ifnum\myct=0 + the same day as +\else + \ifnum\myct<0 + \number-\myct\space day\ifnum\myct<-1s\fi\space before + \else + \number\myct\space day\ifnum\myct>1s\fi\space after + \fi +\fi +\DTMusedate{mydate2}. + +Original date: 2014-06-3 20:45:00 +06:00 + +\DTMsaveaszulutime{mydate}{2014}{6}{3}{20}{45}{0}{6}{0} +UTC+00:00 date: \DTMuse{mydate}. + +\DTMsavetimestamp{mydate}{2014-05-01T03:55:00 -06:00} +Original date: \DTMuse{mydate}. + +\DTMtozulu{mydate}{mydate2} +UTC+00:00: \DTMuse{mydate2}. + +Offset: \DTMdate{2015-03-30+4}. + +Last: \DTMdate{2015-02-last}. + +Last with offset: \DTMdate{2015-02-last+-2}. + +Saved date with offset +\DTMsavedate{offset}{2015-02-last+-2} + +Use date: \DTMusedate{offset}. + +\end{document} diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-filedate.pdf b/macros/latex/contrib/datetime2/samples/datetime2-sample-filedate.pdf Binary files differnew file mode 100644 index 0000000000..3e2c3e54d2 --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-filedate.pdf diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-filedate.tex b/macros/latex/contrib/datetime2/samples/datetime2-sample-filedate.tex new file mode 100644 index 0000000000..bf9df37ce8 --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-filedate.tex @@ -0,0 +1,23 @@ +% This file is public domain. + +% arara: pdflatex +% May also work with lualatex on some platforms (such as Linux) +% but the file mod date is not supported with xelatex. +% (The time zone %z format with Lua may not work on some platforms.) +% arara: pdflatex +\documentclass{article} + +\usepackage{datetime2} + +\begin{document} +Current date and time: \DTMnow. + +\DTMsavefilemoddate{filemod}{\jobname.tex} + +File modification date: \DTMuse{filemod}. + +Save current date and time. +\DTMsavenow{mydate} + +Now use it: \DTMuse{mydate}. +\end{document} diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-hyperref.pdf b/macros/latex/contrib/datetime2/samples/datetime2-sample-hyperref.pdf Binary files differnew file mode 100644 index 0000000000..b26477e0e4 --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-hyperref.pdf diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-hyperref.tex b/macros/latex/contrib/datetime2/samples/datetime2-sample-hyperref.tex new file mode 100644 index 0000000000..ed881d5e02 --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-hyperref.tex @@ -0,0 +1,81 @@ +% This file is public domain. +% This document additionally requires the datetime2-english module +% to be installed. + +% arara: pdflatex +% arara: pdflatex +\documentclass[en-GB,en-US,en-AU]{article} + +\usepackage[datesep=/,showzoneminutes=false]{datetime2} +\usepackage[colorlinks]{hyperref} + +\DTMsetup{showdow} + +\DTMsavetimestamp{mydate}{2014-06-03T12:45:02+01:00} + +\begin{document} +\tableofcontents + +The use of \verb|\typeout| is to test the expansion in the event +that the date/time needs to be written to an external file. +Use +\texttt{\href{http://www.dickimaw-books.com/latex/novices/html/texdoc.html}{texdoc} datetime2} to read the main user manual for +the \texttt{datetime2} package and use \texttt{texdoc +datetime2-english} for the English module documentation. + +\section{Default date: \today} + +Today: \today. Time: \DTMcurrenttime. Zone: \DTMcurrentzone. + +Now: \DTMnow. + +TWO DIGITS: \DTMtwodigits{2014}. \DTMtwodigits{2999}. +\DTMtwodigits{-2}. + +\typeout{Date Stamp (Default): \DTMnow} + +Saved date: \DTMusedate{mydate}. +Saved time: \DTMusetime{mydate}. + +Saved date-time: \DTMuse{mydate}. + +\typeout{Date Stamp (Default): \DTMuse{mydate}} + +\section{Default time: \DTMusetime{mydate}} + +\DTMsetstyle{iso} + +ISO: \DTMnow. +\typeout{Date Stamp (ISO): \DTMnow} + +Saved date: \DTMuse{mydate}. +\typeout{Date Stamp (ISO): \DTMuse{mydate}} + +\DTMsetstyle{en-GB} +\section{(GB) \DTMusedate{mydate}} + +en-GB: \DTMnow. +\typeout{Date Stamp (GB): \DTMnow} + +Saved date: \DTMuse{mydate}. +\typeout{Date Stamp (GB): \DTMuse{mydate}} + +\DTMsetstyle{en-US} +\section{(US) \DTMusedate{mydate}} + +en-US: \DTMnow. +\typeout{Date Stamp (US): \DTMnow} + +Saved date: \DTMuse{mydate}. +\typeout{Date Stamp (US): \DTMuse{mydate}} + +\DTMsetstyle{en-AU} +\section{(AU) \DTMusedate{mydate}} + +en-AU: \DTMnow. +\typeout{Date Stamp (AU): \DTMnow} + +Saved date: \DTMuse{mydate}. +\typeout{Date Stamp (AU): \DTMuse{mydate}} + +\end{document} diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-journal.pdf b/macros/latex/contrib/datetime2/samples/datetime2-sample-journal.pdf Binary files differnew file mode 100644 index 0000000000..5fd3663335 --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-journal.pdf diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-journal.tex b/macros/latex/contrib/datetime2/samples/datetime2-sample-journal.tex new file mode 100644 index 0000000000..26aa64535e --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-journal.tex @@ -0,0 +1,127 @@ +% arara: pdflatex +% arara: pdflatex +\documentclass{memoir} + +\usepackage[en-GB,showdow]{datetime2} + +\usepackage{lipsum}% dummy text +\usepackage[hidelinks]{hyperref} + +\newcommand*{\numdash}{\texorpdfstring{\,--\,}{--}} + +% \DTMmonthname is robust and can't be used in the bookmarks +% or headings so use \DTMenglishmonthname since this +% document is in English. +\newcommand*{\entrymonth}[2]{\DTMenglishmonthname{#2} #1} + +% A range of dates. +% Syntax: \daterange{yyyy1}{mm1}{dd1}{yyyy2}{mm2}{dd2} +\newcommand*{\daterange}[6]{% + \ifnum#1=#4 +% Same year + \ifnum#2=#5 +% Same month + \ifnum#3=#6 +% Same day - not a range! + \DTMdisplaydate{#1}{#2}{#3}% + \else +% Range within the same month. +% This needs to be done explicitly but match the separators +% with the en-GB style. + \DTMenglishordinal{#3}\numdash\DTMenglishordinal{#6}% + \DTMenGBdaymonthsep + \DTMenglishmonthname{#2}% + \DTMenGBmonthyearsep\number#1 + \fi + \else +% Not the same month + \DTMdisplaydate{#1}{#2}{#3}{-1}\numdash\DTMdisplaydate{#4}{#5}{#6}{-1}% + \fi + \else +% Not same year + \DTMdisplaydate{#1}{#2}{#3}{-1}\numdash\DTMdisplaydate{#4}{#5}{#6}{-1}% + \fi +} + +% range of months +% Syntax: \monthspan{yyyy1}{mm1}{yyyy2}{mm2} +\newcommand*{\monthspan}[4]{% + \ifnum#1=#3 +% Same year + \DTMenglishmonthname{#2}\numdash\DTMenglishmonthname{#4}% + \DTMenGBmonthyearsep\number#1 + \else +% Not the same year + \DTMenglishmonthname{#2}% + \DTMenGBmonthyearsep\number#1 + \numdash\DTMenglishmonthname{#4}% + \DTMenGBmonthyearsep\number#3 + \fi +} + +\newcommand*{\entrydate}[3]{\DTMdisplaydate{#1}{#2}{#3}{-1}} +\newcommand*{\titleentrydate}[3]{\DTMdate{#1-#2-#3}} + +\renewcommand*{\printchaptertitle}[1]{% + {% + \let\entrydate\titleentrydate + \chaptitlefont{#1}% + }% +} + +\setsecheadstyle{\let\entrydate\titleentrydate + \Large\bfseries\memRTLraggedright} + +\begin{document} + +\frontmatter +\tableofcontents + +\mainmatter +\chapter{Introduction} + +This is a test document that illustrates the use of dates within +chapter titles. + +\section{Sample} + +An example section. + +\chapter{\entrymonth{2016}{01}} + +\lipsum + +\section{\entrydate{2016}{01}{01}} + +\lipsum[1-10] + +\section{\entrydate{2016}{01}{02}} + +\lipsum + +\section{\daterange{2016}{01}{04}{2016}{01}{12}} + +\lipsum[1-3] + +\chapter{\entrydate{2016}{02}{03}} + +\lipsum + +\chapter{\monthspan{2016}{02}{2016}{03}} + +\lipsum + +\section{\daterange{2016}{02}{04}{2016}{03}{01}} + +\lipsum + +\chapter{\monthspan{2015}{12}{2016}{01}} + +\lipsum + +\section{\daterange{2015}{12}{20}{2016}{01}{01}} + +\lipsum + + +\end{document} diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-styles.pdf b/macros/latex/contrib/datetime2/samples/datetime2-sample-styles.pdf Binary files differnew file mode 100644 index 0000000000..76dbfd1e82 --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-styles.pdf diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-styles.tex b/macros/latex/contrib/datetime2/samples/datetime2-sample-styles.tex new file mode 100644 index 0000000000..28d042f729 --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-styles.tex @@ -0,0 +1,102 @@ +% This file is public domain. +% This document additionally requires the datetime2-english module +% to be installed. + +% arara: pdflatex +\documentclass[english]{report} + +\usepackage{datetime2} + +%\DTMsetup{showseconds=false,datesep=/,timesep=.} + +\newcommand{\testdate}[1]{% + \DTMsetstyle{#1}\section{Style `#1'}\par + \begin{tabular}{ll} + Now: & \DTMnow.\\ + Positive Time Zone: & \DTMuse{mydate+}\\ + Negative Time Zone: & \DTMuse{mydate-}\\ + Zero Time Zone: & \DTMuse{mydate0} + \end{tabular}\par + \typeout{Date-Time (#1): \DTMnow.}% +} + +\newcommand{\testtime}[1]{% + \DTMsettimestyle{#1}% + \section{#1}\par + \begin{tabular}{ll} + Now: & \DTMcurrenttime.\\ + 0 milliseconds: & \DTMusetime{mydate+}.\\ + 45 milliseconds: & \DTMusetime{mydate2}.\\ + Noon: & \DTMusetime{noon}.\\ + Midnight (0hrs): & \DTMusetime{midnight1}.\\ + Midnight (24hrs): & \DTMusetime{midnight2}.\\ + Morning: & \DTMusetime{8am}.\\ + Evening: & \DTMusetime{8pm}.\\ + Post-Midday: & \DTMusetime{1203}.\\ + Post-Midnight (24hr): & \DTMusetime{2401}.\\ + Post-Midnight (0hr): & \DTMusetime{0001}. + \end{tabular}\par + \typeout{Time (#1): \DTMcurrenttime. + \DTMusetime{mydate}. + \DTMusetime{mydate2}. + \DTMusetime{noon}. + \DTMusetime{midnight1}. + \DTMusetime{midnight2}. + \DTMusetime{8am}. + \DTMusetime{8pm}. + \DTMusetime{1203}. + \DTMusetime{2401}. + \DTMusetime{0001}. + }% +} + +\begin{document} +\chapter{Date-Time Styles} +\DTMsavetimestamp{mydate+}{2015-04-01T08:05:00+01:00} +\DTMsavetimestamp{mydate-}{2015-04-01T08:05:00-01:00} +\DTMsavetimestamp{mydate0}{2015-04-01T08:05:00+00:00} + +\testdate{default} + +\testdate{iso} + +\testdate{pdf} + +\testdate{ddmmyyyy} + +\testdate{dmyyyy} + +\testdate{dmyy} + +\testdate{mmddyyyy} + +\testdate{mdyyyy} + +\testdate{mdyy} + +\testdate{yyyymd} + +\chapter{Time Styles} + +\DTMsavetimestamp{mydate2}{2015-04-01T08:13:45+01:00} +\DTMsavetime{noon}{12:00:00} +\DTMsavetime{midnight1}{00:00:00} +\DTMsavetime{midnight2}{24:00:00} +\DTMsavetime{8am}{08:00:00} +\DTMsavetime{8pm}{20:00:00} +\DTMsavetime{1203}{12:03:00} +\DTMsavetime{2401}{24:01:00} +\DTMsavetime{0001}{00:01:00} + +\testtime{hmmss} + +\testtime{englishampm} + +\renewcommand*{\DTMenglishampmfmt}[1]{\protect\textsc{#1}} + +\bigskip + +(Redefining \verb|\DTMenglishampmfmt| for following test.) +\testtime{englishampm} + +\end{document} diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-xe.pdf b/macros/latex/contrib/datetime2/samples/datetime2-sample-xe.pdf Binary files differnew file mode 100644 index 0000000000..bcf2d0b7ea --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-xe.pdf diff --git a/macros/latex/contrib/datetime2/samples/datetime2-sample-xe.tex b/macros/latex/contrib/datetime2/samples/datetime2-sample-xe.tex new file mode 100644 index 0000000000..09c2a33298 --- /dev/null +++ b/macros/latex/contrib/datetime2/samples/datetime2-sample-xe.tex @@ -0,0 +1,20 @@ +% arara: xelatex: {shell: on} +\documentclass{article} + +\usepackage{texosquery} +% Disable texosquery: +%\TeXOSQueryDryRuntrue +\usepackage{datetime2} + +% If you get an error that looks like: +% ! I can't find file `"|texosquery -n"'. +% Then the shell escape has been restricted and texosquery +% wasn't allowed to run. + +\begin{document} +\DTMnow. + +\DTMsavefilemoddate{moddate}{\jobname.tex} +File \texttt{\jobname.tex} last modified: \DTMuse{moddate}. + +\end{document} |