0

I have been struggling with this for some time, with combinations of the isodate and datetime packages, without success.

I would like to create a macro that receives an input in the format {yyyy-mm-dd} and returns "mmm 'yy". For example {2014-11-04} => Nov '14

I would also like for it to work for languages other than English.

Like a say, seems to be something that isodate could handle, and yet...

Cheers.

2
\documentclass{article}



\def\shortdate#1{\ifcase#1\relax\or
    Jan\or Feb\or Mar\or Apr\or May\or Jun\or
    Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi}

\def\mydate#1{\xmydate#1\relax}

\def\xmydate#1#2#3#4-#5-#6\relax{%
\shortdate{#5} '#3#4}

\begin{document}


\mydate{2014-11-04}

\end{document}
  • Thanks David, By far the most elegant solution I have seen. I almost go there myself adapting the answer from [this post][1]. I used "datetime" to look up "\shortmonthname". Parsing inputs like this is really powerful, but as a newbie the use of TeX primitives is a bit daunting. [1]: tex.stackexchange.com/q/138617/33533 – Jonathan Nov 5 '14 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.