0

Sorry! My "solution" at the bottom didn't actually fix the problem, and the reasons I thought it did are too embarrassing to post. I did manage to solve the problem, by having a total of FOUR TeX runs rather than the usual three.

I have been making a dictionary-style reference book based on the beautiful "bilingual dictionary" showcased here. I included the tabs down the side with the current letter in white on a black rectangle.

It worked beautifully until I added the references using the "natbib" package. Since then, the tabs on the ODD pages only are appearing at the wrong x coordinate, though their y coordinates are correct. Many are in the correct page, but some wander to the right, even completely off the page, and some wander to the left, covering up text. When I comment out the natbib includepackage (and put in dummy macros so that it compiles), the tabs work fine again.

I have not yet worked up a minimal example, but I'm hoping someone may have ideas that will fix it without spending the time doing that.

Here is the operative part of the code:

\newcommand{\oddthumb}[1]{%
\begin{tikzpicture}[remember picture, overlay]
    \node [thumb,fill=\BoxColor, anchor=north east,] at ($%
        (current page.north east)-%
        (0,\thumbtopmargin+\value{letternum}*\thumbheight)%
    $) {#1};
   \end{tikzpicture}
}
\newcommand{\eventhumb}[1]{%
\begin{tikzpicture}[remember picture, overlay]
    \node [thumb,fill=\BoxColor, anchor=north west,] at ($%
        (current page.north west)-%
        (0,\thumbtopmargin+\value{letternum}*\thumbheight)%
    $) {\hspace*{.375in}#1};%was .125
   \end{tikzpicture}
 }

% this macro is invoked at the beginning of each new letter, i.e., A, B, C, etc

\newcommand{\lettergroup}[1]{%
\fancyhead[LE]{\eventhumb{#1}{\sffamily\selectfont{\textbf{\thepage\hspace{1 em}\rightmark}}}}%
\fancyhead[RO]{\oddthumb{#1}{\sffamily\selectfont{\textbf{\leftmark\hspace{1 em}\thepage}}}}%
\stepcounter{letternum}%step the counter of the letters
}
Nat Kuhn
  • 676
  • OK, so in cleaning up the code above I was deleting the "was .125" after the % when I noticed that there was no corresponding % after the "{#1};" in the \oddthumb command. I put it in and PROBLEM FIXED. Is there a tag for "Why I hate TeX" or--more properly--"Why TeX drives me crazy"? It is insanely fragile and impenetrable. Any quick explanations of why the lack of % caused the problem, after natbib was added? Thanks! – Nat Kuhn Feb 28 '14 at 02:57
  • 1
    This should not be a problem, since % need not be used in pairs. However, there's no {#1} in \oddthumb. – Werner Feb 28 '14 at 03:12
  • @Werner, thanks for your answer. I'm a little confused--I have $) {#1}; as the 6th line of code, which is part of \oddthumb. Perhaps you can't see this for some reason. Inserting the % after the ; fixed the problem, but yes, as you say, it had nothing to do with using % in pairs, obviously. The corresponding line in \eventhumb is $) {\hspace*{.375in}#1};%was .125. It has the \hspace* to shift the letter over, but is otherwise the same. – Nat Kuhn Mar 01 '14 at 20:51
  • @NatKuhn, since this is solved (I presume), would you like to write a self-answer? Or what should the status or this question be? – Paul Gessler Mar 13 '14 at 15:45
  • @PaulGessler, new to stackexchange, but I have now posted the self-answer. Anything else I need to do to change the status? Thanks, Nat – Nat Kuhn Mar 14 '14 at 17:04

1 Answers1

1

Because tikz depends on results written in aux files, adding a bibliography necessitates an extra run through the TeX engine. BibTex needs two runs after running BibTex (a total of three runs). I already had two post-BibTex runs, but it turns out I needed to add another run (for a total of four) in order to get the correct information to the aux files to get the tikz pictures working again.

Nat Kuhn
  • 676