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.

\footfullcite uses too much space so I decided to define a own command. I called it \footshortcite. It only display a pre- and a post-Option and the Author with Year. However, I don't like that most citations in the footnote by my new command only use 1/4 or 1/3 of the line length, so I had the idea to put the title of the citation on top and cut it after X characters so that the footnote-citation is round about one complete line length.

I tried it with xstring but it seems that \citetitle is not fully expandable, so that \StrLeft has no effect on it.

Did I something wrong or am I right and its not possible?

\RequirePackage{filecontents}
\begin{filecontents*}{Literatur.bib}

@BOOK{denz2005,
author = {Denz, Hermann},
title = {Grundlagen einer empirischen Soziologie: Der Beitrag des quantitativen
Ansatzes},
publisher = {Lit},
location = {M\"unster},
year = {2005}
}

\end{filecontents*}

\documentclass{scrartcl}                

\usepackage[style=authoryear]{biblatex}
\bibliography{Literatur}
\usepackage{optparams}
\usepackage{xstring}

\def\footshortciteintern[#1][#2]#3{%
\ifx#1\empty 
% Nur Autor
\footnote{\citeauthor{#3}, \citeyear{#3}.}
\else
\ifx#2\empty
% Autor und Seite
\footnote{\citeauthor{#3}, \citeyear{#3}, #1.}
\else
% Autor, Seite und vgl.
\expandafter  
\footnote{#1 \citeauthor{#3}, \StrLeft{\citetitle{#3}}{10}, \citeyear{#3}, #2.}
\fi
\fi
}
\newcommand*\footshortcite{%
\optparams{\footshortciteintern}{[\empty][\empty]}
}

\begin{document}

Hallo \footshortcite[vgl.][S.111]{denz2005}
%\footshortcite[S.111]{denz2005}
%\footshortcite{denz2005}

\end{document}
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Your best bet is biblatex's \DeclareCiteCommand. It enables you to easily pass bibliographic data to xstring, format titles according to entry type and define multicite versions of new citation commands.

Truncation of titles may not work well in general (see the image below). I've added an alternative that makes use of the shorttitle entry field.

The only xstring macro used here is StrLeft, so details on how this code works can be found in the biblatex manual.

\documentclass{scrartcl}
\usepackage[style=authoryear]{biblatex}
\usepackage{csquotes}
\usepackage[german]{babel}
\usepackage{xstring}
\usepackage{filecontents}

\DeclareFieldFormat[article]{citetitle}{\mkbibquote{#1}}
\DeclareFieldFormat[book]{citetitle}{\mkbibemph{#1}}

\DeclareCiteCommand{\foottrunccite}[\mkbibfootnote]
    {\usebibmacro{prenote}}
    {\usebibmacro{citeindex}%
        \usebibmacro{cite:trunc}}
    {\multicitedelim}
    {\usebibmacro{postnote}}

\newbibmacro*{cite:trunc}{%
    \iffieldundef{shorthand}
        {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
                {\usebibmacro{cite:label}%
                    \setunit{\addspace}}
                {\printnames{labelname}%
                    \setunit{\nameyeardelim}}%
            \usebibmacro{cite:labelyear+extrayear}%
            \iffieldundef{title}
                {}
                {\addcomma\addspace%
                    \printtext[citetitle]{\StrLeft{\thefield{labeltitle}}{10}}}}
        {\usebibmacro{cite:shorthand}}}

\DeclareCiteCommand{\footshortcite}[\mkbibfootnote]
    {\usebibmacro{prenote}}
    {\usebibmacro{citeindex}%
        \usebibmacro{cite:title}}
    {\multicitedelim}
    {\usebibmacro{postnote}}

\newbibmacro*{cite:title}{%
    \iffieldundef{shorthand}
        {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
                {\usebibmacro{cite:label}%
                    \setunit{\addspace}}
                {\printnames{labelname}%
                    \setunit{\nameyeardelim}}%
            \usebibmacro{cite:labelyear+extrayear}%
            \setunit{\addcomma\addspace}
            \iffieldundef{shorttitle}
                {\printfield[citetitle]{labeltitle}}
                {\printfield[citetitle]{shorttitle}}}
        {\usebibmacro{cite:shorthand}}}

\DeclareMultiCiteCommand{\footshortcites}[\mkbibfootnote]%
    {\footshortcite}{\multicitedelim}

\DeclareMultiCiteCommand{\foottrunccites}[\mkbibfootnote]%
    {\foottrunccite}{\multicitedelim}

\begin{filecontents*}{\jobname.bib}
@BOOK{denz2005,
    author = {Denz, Hermann},
    title = {Grundlagen einer empirischen Soziologie: Der Beitrag des quantitativen Ansatzes},
    shorttitle = {Grundlagen einer empirischen Soziologie},
    publisher = {Lit},
    location = {M\"unster},
    year = {2005}}
@ARTICLE{angenendt,
  author = {Angenendt, Arnold},
  title = {In Honore Salvatoris~-- Vom Sinn und Unsinn der Patrozinienkunde},
  shorttitle = {In Honore Salvatoris},
  journaltitle = {Revue d'Histoire Eccl{\'e}siastique},
  volume = {97},
  date = {2002},
  pages = {431--456}}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
Vanilla footcite.\footcite[vgl.][111]{denz2005}
Vanilla footcites.\footcites[vgl.][111]{denz2005}[456]{angenendt}
Like footcite, but with short title.\footshortcite[vgl.][111]{denz2005}
Like footcites, but with short title.\footshortcites[vgl.][111]{denz2005}[456]{angenendt}
Like footcite, but with truncated title.\foottrunccite[vgl.][111]{denz2005}
Like footcites, but with truncated title.\foottrunccites[vgl.][111]{denz2005}[456]{angenendt}
\end{document}

enter image description here

share|improve this answer
    
Thank you a lot! –  Dabauer82 Jun 16 '11 at 14:29
add comment

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.