Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
  1. Here is a piece of solution to automate a dictionary using the links given in the first following comments.

    There are two problems to solve :

    • When one definition starts on one page and finishes on another, the words in the headinga are not the good ones. In my example below, take a look at the page 1 where the last word must be adhesive and not adhesion, and in the page 2, the first word must be adjacent and not adhesive. Is there a way to solve this problem ?
    • Secundly, I would like the letter A of the section to be centerd using \textbf{\textsf{...}} for formatting.

    Here is the code that I've wanted to improve.

    % Sources :
    %    1) http://tex.stackexchange.com/questions/30392/how-could-one-setup-a-layout-for-a-dictionary-if-possible
    %    2) http://tex.stackexchange.com/questions/26122/indexing-an-interval-of-words-on-top-of-every-page
    
    \documentclass[twoside]{article}
        \usepackage{multicol}
        \usepackage{ifthen}
        \usepackage{fancyhdr}
        \usepackage{enumerate}
        \usepackage{lipsum}
    
    % Empty \sectionmark
        \renewcommand{\sectionmark}[1]{}
    
        \fancyhead[L]{\textsf{\rightmark}}
        \fancyhead[R]{\textsf{\leftmark}}
        \fancyfoot[C]{\textbf{\textsf{\thepage}}}
    
    % Entry command : \dict{<word>}{<gender>}{<text>}
        \newcommand{\dict}[3]{%
            \par\vspace{0.25\baselineskip} %
            \textbf{\textsf{#1}} \textit{#2} #3 %
            \markboth{#1}{#1}
        }
    
        \pagestyle{fancy}
    
    
    \begin{document}
    
    \section*{A}
    
    \begin{multicols}{2}
        \dict{adequate}{n}{\lipsum[1]}
        \dict{adhere}{n}{\lipsum[2]}
        \dict{adherence}{n}{\lipsum[3]}
        \dict{adhesion}{n}{\lipsum[4]}
        \dict{adhesive}{n}{\lipsum[5]}
        \dict{adjacent}{n}{\lipsum[6]}
        \dict{adjective}{n}{\lipsum[1]}
        \dict{adjoin}{n}{\lipsum[2]}
        \dict{adjourn}{n}{\lipsum[3]}
        \dict{adjournment}{n}{\lipsum[4]}
        \dict{adjunt}{n}{\lipsum[5]}
        \dict{adjust}{n}{\lipsum[6]}
    \end{multicols}
    
    \end{document}
    
  2. The solution found is the following one even if there is one remaining disturbing behavior, even if it is logical : in the last page of the output of the following code, zero appears in both headers...

    % Sources :
    %    1) http://tex.stackexchange.com/questions/30392/how-could-one-setup-a-layout-for-a-dictionary-if-possible
    %    2) http://tex.stackexchange.com/questions/26122/indexing-an-interval-of-words-on-top-of-every-page
    %    3) http://tex.stackexchange.com/questions/30947/how-to-automate-a-dictionary-sorting-headers/31017#31017
    
    \documentclass[twoside]{article}
        \usepackage{multicol}
        \usepackage{fancyhdr}
        \usepackage[bf,sf,center]{titlesec}
    
    % Headers and footers
        \fancyhead[L]{\textsf{\rightmark}}
        \fancyhead[R]{\textsf{\leftmark}}
    
        \fancyfoot[C]{\textbf{\textsf{\thepage}}}
    
        \renewcommand{\headrulewidth}{1.4pt}
        \renewcommand{\footrulewidth}{1.4pt}
    
    % Entry command : \dict{<word>}{<gender>}{<text>}
        \newcommand{\dict}[3]{%
            \markboth{#1}{#1}%
            \par\vspace{0.25\baselineskip}%
            \textbf{\textsf{#1}} \textit{- #2 -} #3%
        }
    
        \pagestyle{fancy}
    
    % For testing
        \usepackage{lipsum}
    
    
    \begin{document}
    
    \section*{A}
    
    \begin{multicols}{2}
        \dict{adequate}{n}{\lipsum[1]}
        \dict{adhere}{n}{\lipsum[2]}
        \dict{adherence}{n}{\lipsum[3]}
        \dict{adhesion}{n}{\lipsum[4]}
        \dict{adhesive}{n}{\lipsum[5]}
        \dict{adjacent}{n}{\lipsum[6]}
        \dict{adjective}{n}{\lipsum[1]}
        \dict{adjoin}{n}{\lipsum[2]}
        \dict{adjourn}{n}{\lipsum[3]}
        \dict{adjournment}{n}{\lipsum[4]}
        \dict{adjunt}{n}{\lipsum[5]}
        \dict{adjust}{n}{\lipsum[6]}
    \end{multicols}
    
    
    \section*{M}
    
    \begin{multicols}{2}
        \dict{main}{n}{\lipsum[3]}
        \dict{material}{n}{\lipsum[1]}
        \dict{mathematic}{n}{\lipsum[2]}
        \dict{more}{n}{\lipsum[2]}
    \end{multicols}
    
    
    \section*{Z}
    
    \begin{multicols}{2}
        \dict{zebra}{n}{\lipsum \lipsum \lipsum}
        \dict{zero}{n}{\lipsum[4]}
    \end{multicols}
    
    \end{document}
    
share|improve this question
1  
Does this post help: tex.stackexchange.com/questions/26122/… –  cmhughes Oct 8 '11 at 18:34
2  
There's no need to edit the question title with (SOLVED). You already "marked" the question this way by accepting an answer. –  lockstep Oct 9 '11 at 12:42
2  
I reverted your question to version 3, the one before your problem was solved. This way, other users can see what the original problem was and what you were looking for. If the solution you eventually used differs decisively from lockstep's, you're welcome to add an answer of your own. If you just want to comment on the way you used it, add a comment to lockstep's answer. –  doncherry Oct 9 '11 at 12:47
1  
With regard to your latest question: You need to figure out what your requirements exactly are. If zebra should replace zero on the last page, why shouldn't adhesive replace adjacent on the second page? –  lockstep Oct 9 '11 at 13:21
1  
Thank you for being so patient in dealing with this site's habits in terms of what belongs where. You'll soon get the hang of it, as I hope you'll stick around -- I really like your question and the dictionary looks great! –  doncherry Oct 9 '11 at 13:23

1 Answer 1

up vote 4 down vote accepted

With regard to your first question (wrong header entries): In your \dict macro, use \markboth before typesetting the entry text.

\newcommand{\dict}[3]{%
  \markboth{#1}{#1}%
  \par\vspace{0.25\baselineskip}%
  \textbf{\textsf{#1}} \textit{#2} #3%
}

With regard to your second question (formatting the sectioning heading): Use, e.g.,

\usepackage[bf,sf,center]{titlesec}
share|improve this answer
    
Thanks for all ! –  projetmbc Oct 9 '11 at 12:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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