10

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

  • @Torbjørn_T. Tanks for edition – Zouib Mar 3 '14 at 13:49
6

after several hours of hard amateur work, I publish the command I'd baptized \qd like the french word "quand" (which means "when"). That's the complete form : \qd*[]{}{}{}{}{}{}. I explain you the use :

  • I put * for negative dates, nothing for positives dates
  • the first argument [#1] is a text argument with different usages. Look at the complete code for greater understanding. If I want to write an event, for exemple [french Revolution], it's the place to. If I want only write a date, I propose 7 options :
    • [] nothing for single form of the date
    • [l] for using a long form
    • [c] for the short form (forme courte in french)
    • [t] for the very short form (forme très courte)
    • [j] for the single form with de name of the day of week (jour) from 1901
    • [jc] for the short form with de name of the day of week (jour court)
    • [jt] for the very short form with de name of the day of week (jour très court)
  • The 6 other arguments represent the date elements :
    • {#2} millenium (0 to ∞)
    • {#3} century (0 to 9)
    • {#4} decade (0 to 9)
    • {#5} year (0 to 9)
    • {#6} month (1 to 12)
    • {#7} day (1 to 31)

Look, here some exemples :

Le \qd*[Néolithique]{10}{}{}{}{}{} commence au \qd*[]{10}{}{}{}{}{}, \\
Des \qd*[hiéroglyphes]{3}{2}{}{}{}{} à l'\qd*[alphabet phénicien]{1}{1}{}{}{}{} \\
Les \qd*[c]{1}{0}{}{}{}{}, \qd*[c]{1}{1}{}{}{}{}, \\ 
En \qd*[l]{0}{9}{8}{3}{}{} & dans les \qd*[]{2}{0}{0}{}{}{}, \\
En \qd*[]{0}{3}{3}{2}{}{}-\qd*[c]{0}{3}{3}{1}{}{}, Alexandre devient pharaon, \\
Le \qd*[l]{0}{0}{4}{4}{3}{15}, on entendit un \qd*[\emph{tu quoque}]{0}{0}{4}{4}{3}{15}, \\
Le \qd*[c]{0}{0}{0}{1}{12}{25}, Marie cria, \\
\qd[l]{0}{0}{0}{9}{1}{1}, \\
Les \qd[c]{1}{0}{}{}{}{} & \qd[c]{1}{1}{}{}{}{}, \\ 
L'\qd[hégire]{0}{6}{2}{2}{7}{16}, \\
Le \qd[]{1}{7}{8}{9}{7}{14} changea la destinée de la France, \\
Du \qd[jc]{1}{9}{9}{9}{12}{31} au \qd[j]{2}{0}{0}{0}{1}{1}, \\
Du \qd[jt]{1}{9}{8}{4}{1}{1} au \qd[j]{1}{9}{8}{4}{1}{2}, jour de \qd[naissance]{1}{9}{8}{4}{1}{2}.

This is the text :

The text

& the index :

The index

I encountered some difficulties which I summarize here with solutions:

  • For ranking the negatives dates in the index who don't know negative numbers, I use in the command some fractions like 1/((#2)+1), thereby rank for millenium in index is good : -3(=1/4), -2(=1/3), -1(=1/2), 1, 2, 3…,
  • for differences between 18th century \qd[]{1}{8}{}{}{}{} linked in the index with 1789 \qd[]{1}{7}{8}{9}{}{}, I use some additions (look at the complete code)
  • I make differences between first (millenium, century, decade or year) and others, for exemple \ifthenelse{\equal{#2}{0}}{…}{…}, because year 2000 is in the 2th millenium, 20th century, but in the 2000 decade… (look at the complete code ;)
  • I'm using now arara & some packages like datetime, fp awkwardly, glossaries & imakeidx, big evolution for me.

So, I put her the command & the complete code, because it seems to long here. I see some errors in the compilation, but, it look perfectly in the document. If someone want to simplify this heavy command, I listen to your proposals. Thanks for your help. Bye

| improve this answer | |
  • tenacious work! ;-) – user4686 May 13 '14 at 17:44
  • to improve, isn't it ? – Zouib May 13 '14 at 18:22
  • But, I'm unable to use the package seealso! Any idea ? – Zouib May 14 '14 at 10:26
  • I suggest you try seealso package and possibly make a new questio. – user4686 May 14 '14 at 15:15
  • @jfbu I tried here, but for now without success : tex.stackexchange.com/questions/179628/… – Zouib Aug 22 '14 at 8:21

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.