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
1where the last word must beadhesiveand notadhesion, and in the page2, the first word must beadjacentand notadhesive. 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}- 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
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,
zeroappears 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}
1 Answer
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}
(SOLVED). You already "marked" the question this way by accepting an answer.zebrashould replacezeroon the last page, why shouldn'tadhesivereplaceadjacenton the second page?