I'm writing my thesis & I want to make an index with centuries, years, month, day, event & historical periods. So I try to build some commands, but unsatisfactory, I'm looking for your help.
What are difficulties ?
- I have numerical datas & names (l'armistice, 15 janvier 1857, 1455, 19ème siècle)
- I have some composed periods (1801-1812, du 11ème au 13ème siècle)
- I need to indent my index (
event!day!month!year!centuries
) - Sometime, I have only century, or year
- I want to classify all dates & centuries BCE (-200 ; -3 ; 23 ; 190 ; 1850 ; 2014)
- I don't know whether to make one or more commands
What I tried :
First step, a command for only centuries who's good, with a *
for BCE centuries (For classify negatives centuries, I use fractions) :
% !TEX encoding = UTF-8 Unicode
\documentclass{scrbook}
\usepackage[english,frenchb]{babel}
\usepackage[quiet]{fontspec}
\usepackage[automark]{scrpage2}
\usepackage[babel,french=guillemets*]{csquotes}
\usepackage{index}
\usepackage{ifthen}
\usepackage{ifmtarg}
\usepackage{fp}
\setmainfont{Adobe Garamond Pro}
\addtokomafont{disposition}{\normalfont}
\makeindex
\newindex{can}{cax}{cad}{Index des périodes} % makeindex period.cax -o period.cad
\makeatletter\newcommand*{\sivide}{\@ifmtarg}\makeatother
\makeatletter\newcommand*{\sistar}{\@ifstar}\makeatother
\newcommand*{\siglo}{\sistar\siglom\siglop}
\newcommand\siglop[1]%
{\ifthenelse{#1 = 1}%
{#1\up{er}~siècle de notre ère\index[can]{#1@#1\up{er}~siècle de notre ère}}%
{#1\up{ème}~siècle\index[can]{#1@#1\up{ème}~siècle}}}%
\newcommand\siglom[1]%
{\ifthenelse{#1 = 1}%
{#1\up{er}~siècle avant notre ère\index[can]{0,6@1\up{er}~siècle avant notre ère}}%
{#1\up{ème}~siècle avant notre ère\index[can]{\FPeval{\fraction}{1/#1}\fraction @#1\up{ème}~siècle avant notre ère}}}
\begin{document}
\siglo*{12} … \siglo*{1} … \siglo{14} … \siglo{1}
\printindex[can]
\end{document}
Another command (who remplace the first) for centuries & years, but my index fail :
\newcommand*{\lan}{\sistar\lans\lano}
\newcommand\lano[2]%
{\sivide{#2}%
{{\ifthenelse{#1 = 1}%
{#1\up{er}~siècle de notre ère\index[can]{#1@#1\up{er}~siècle de notre ère}}%
{#1\up{ème}~siècle\index[can]{#1@#1\up{ème}~siècle}}}}%
{\sivide{#1}%
{#2 de notre ère\index[can]{1\up{er}~siècle de notre ère!#2@#2}}%
{#1#2\index[can]{\FPeval{\fraction}{#1+1}\fraction \up{ème}~siècle!#2@#1#2}}}}
\newcommand\lans[2]%
{\sivide{#2}%
{{\ifthenelse{#1 = 1}%
{#1\up{er}~siècle avant notre ère\index[can]{0,6@1\up{er}~siècle avant notre ère}}%
{#1\up{ème}~siècle avant notre ère\index[can]{\FPeval{\fraction}{1/#1}\fraction @#1\up{ème}~siècle avant notre ère}}}}
{\sivide{#1}%
{-#2\index[can]{1\up{er}~siècle avant notre ère!\FPeval{\fraction}{1/#2}\fraction @-#2}}%
{-#1#2\index[can]{\FPeval{\fraction}{#1+1}\fraction \up{ème}~siècle avant notre ère !\FPeval{\fraction}{1/#2}\fraction @-#1#2}}}}
and in the text
\lan*{12}{} … \lan*{1}{} … \lan{14}{} … \lan{1}{} …
\lan*{11}{16} … \lan*{}{18} … \lan{}{20} … \lan{19}{90} …
So after, I'm stuck ! Thank you for your help