I created this simple macro, for citing papers. Basically just use this format:

\turabian{bibtextkey}{page range}

or

\turabian{smith1980}{10-23}

...and it places a citation.

Now, one feature I needed was if the bibtextkey ever repeated, it should instead display "Ibid. p. 10-23"

So if I have text like this...

This is a passage about some trees. The trees were tall. \turabian{smith1980}{2-30} The trees were also really green.\turabian{smith1980}{40-44}

...the second citation just displays the "Ibid., p. 40-44".

I did this by at the end of the macro, setting \setvalue{previousmymacro}{#1}, then checking if that value is the same the next time hte macro is called. So its just checking, if #1 is same as last time the macro was called, then use Ibid.

Something though isn't working as expected. Why isn't this displaying Ibid. when it should for repeated bibtextkeys?

--Joel

Code:

\let\previousmymacro\empty
\define[2]\turabian{%
    \iftok{#1}{\getvalue{previousmymacro}}%
        \doifemptyelse{#2}{%
            \footnote{Ibid.}\nocite[#1]%
        }{%
            \footnote{Ibid., #2.}\nocite[#1]%
        }%
    \else%
        \doifemptyelse{#2}{%
            \cite[#1]%
        }{%
            \cite[loctext={#2}][#1]%
        }%
    \fi%
        \setvalue{previousmymacro}{#1}%
}%