0

I have a .bib file that gets displayed in the end of my document but i wold like to add the referenced sections (with \cite(ref1)) to every corresponiding page footer automaticaly. Is that possible?

mwe:

\documentclass{article}
    \usepackage[utf8]{inputenc}
    \usepackage[greek,ngerman]{babel}
    \usepackage{lastpage}
    \usepackage{fancyhdr}
    \pagestyle{fancy}
      \renewcommand{\headrulewidth}{0.1pt} 
      \renewcommand{\footrulewidth}{0.1pt}
      \setlength{\headheight}{16pt} 
    \usepackage{titlesec}
    \usepackage{hyperref}
    \usepackage{blindtext}              
    \begin{document}
      \setcounter{page}{1} 
      \tableofcontents          
      \thispagestyle{empty}         
      \clearpage                    
    \section{first section}
            Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna \cite{einstein} aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
    \footnote{\let\cite=\footcite} % <------- this is the second try
    \subsection{first subsection}
    \blindtext
    \blindtext
    \subsubsection{first subsubsection}
    \blindtext
    \paragraph{first paragraph}
    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna \cite{latexcompanion} aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
    \let\cite=\footcite %<---------- this is the first try
    \newpage
    \thispagestyle{empty}
    \section{References}
    \begin{thebibliography}{9}
    \bibitem{latexcompanion} 
    Michel Goossens, Frank Mittelbach, and Alexander Samarin. 
    \textit{The \LaTeX\ Companion}. 
    Addison-Wesley, Reading, Massachusetts, 1993.
    \bibitem{einstein} 
    Albert Einstein. 
    \textit{Zur Elektrodynamik bewegter K{\"o}rper}. (German) 
    [\textit{On the electrodynamics of moving bodies}]. 
    Annalen der Physik, 322(10):891–921, 1905.
    \end{thebibliography}
    \end{document}
  • Does this: tex.stackexchange.com/questions/280190/… help? – koleygr Oct 19 '17 at 6:38
  • no im looking for a automated way to generate that what \footcite{ref1} does on every site where i have a \cite(ref1). – novski Oct 19 '17 at 7:11
  • just add in your preamble \let\cite=\footcite – koleygr Oct 19 '17 at 7:17
  • i get an error. How do you mean "in preamble"? If i add it before the \cite{ref2} it stops with an error. After it runs over but doesn't print anything. I then tried to nest it like that \footnote{\let\cite=\footcite} and it prints a "1". What i don't understand. – novski Oct 19 '17 at 19:37
  • we have no info about your code and you already know that this (and such) forum is giving solution according to MWEs. Please add a code that will compile and will contain at least your documentclass, some entries inside filecontents environment (if you use a .bib file) [just like the linked answer] and any package or code added in your code that may be changes the bibliography behavior. I will give you a working solution in some minutes... But if we don't get a MWE and if the code I will give you can not work for you... then there is no way to help you – koleygr Oct 19 '17 at 19:47
2

Ok... here is a WE:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{Goossens,
  author    = {Goossens, Michel and Mittelbach, Frank and 
               Samarin, Alexander},
  title     = {The LaTeX Companion},
  edition   = {1},
  publisher = {Addison-Wesley},
  location  = {Reading, Mass.},
  year      = {1994},
}
@Book{adams,
  title     = {The Restaurant at the End of the Universe},
  author    = {Douglas Adams},
  series    = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year      = {1980},
}
@article{einstein,
  author  = {Albert Einstein},
  title   = {{Zur Elektrodynamik bewegter K{\"o}rper}. ({German}) 
             [{On} the electrodynamics of moving bodies]},
  journal = {Annalen der Physik},
  volume  = {322},
  number  = {10},
  pages   = {891--921},
  year    = {1905},
  DOI     = {http://dx.doi.org/10.1002/andp.19053221004},
}
@misc{mozart:KV183,
  author  = {Mozart, Wolfgang Amadeus},
  title   = {Sinfonie g-Moll},
  year    = {1773},
  address = {Salzburg},
  note    = {New K{\"o}chelverzeichnis Nr. 183, old version Nr. 25; 
             Erster Satz: Allegro con brio, Zweiter Satz: Andante, 
             Dritter Satz: Menuetto, Vierter Satz: Allegro},
}
\end{filecontents*}

\documentclass{article}

\usepackage[backend=biber, style=numeric, defernumbers]{biblatex}
\usepackage{lipsum}
\addbibresource{\jobname.bib}
\DeclareBibliographyCategory{skipbibliography}
\DeclareCiteCommand{\cite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\addtocategory{skipbibliography}{\thefield{entrykey}}%
   \usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
\begin{document}

This is text with \cite{Goossens} and \cite{adams}. 
And \cite{mozart:KV183}.

\lipsum[1-8]
here is a last footcite \cite{einstein}

\printbibliography[notcategory=skipbibliography]

\pagebreak %<- Remove these lines if you dont nead a bibliography at the end
\printbibliography %<- 2md line to remove

\end{document} 

Source: https://tex.stackexchange.com/a/222622/120578 from user @moewe.

Output:

enter image description here

Follows an ordinary bibliography in new page that you can remove (see lias lines of the code)

PS: \let\cite=\footcite doesn't work... sorry for that! (Thought it was easier)

  • I copied that to my testfile. Seams a good start. Thanks. How can i use a external .bib file? \addbibresource{\jobname.bib} changed to \addbibresource{path/to/my/references.bib} does not work. – novski Oct 19 '17 at 21:15
  • just put it in the same folder as your main file. and then just replace thet line with \bibliography{references} without .bib – koleygr Oct 19 '17 at 21:26
  • well im not able to do so. And with your WE i had problems. There are two packages missing; \usepackage[utf8]{inputenc} & \usepackage[greek,ngerman]{babel} then after adding those i was not able to get a Full Bibliography in the end of your document. Allthrough the footcites are printed exactly as i wold like them. – novski Oct 20 '17 at 6:04
  • @novski , my answer doesn't have the packages you say... these are on the random WE that you posted in your question (and adding a new language package like greek or ngerman is not what I would do for writing am english document). If my example works... then this is my answer... and It works for me. Just don't remove the last lines with the comments to have a full bibliography in the end too – koleygr Oct 20 '17 at 6:48
  • yes i understand. But without removing the last lines it still does not print the full bibliography... – novski Oct 20 '17 at 6:50
0

The Answer koleygr developed for me during the chat is:

    \documentclass{article}
    \usepackage[backend=bibtex, style=numeric, defernumbers]{biblatex}
    \usepackage{lipsum}
    \addbibresource{./latexfiles/ref.bib}
    \DeclareBibliographyCategory{skipbibliography}
    \DeclareCiteCommand{\cite}[\mkbibfootnote]
      {\usebibmacro{prenote}}
      {\addtocategory{skipbibliography}{\thefield{entrykey}}%
       \usedriver
         {\DeclareNameAlias{sortname}{default}}
         {\thefield{entrytype}}}
      {\multicitedelim}
      {\usebibmacro{postnote}}
    \begin{document}

    This is text with \cite{Goossens} and %\cite{adams}. 

    \lipsum[1-8]
    here is a last footcite \cite{einstein}

    \printbibliography[notcategory=skipbibliography]

    \pagebreak %<- Remove these lines if you dont nead a bibliography at the end
    \printbibliography %<- 2md line to remove

    \end{document} 

And in a subfolder file named "latexfiles/ref.bib"

    @Book{Goossens,
    author = {Goossens, Michel and Mittelbach, Frank and
    Samarin, Alexander},
    title = {The LaTeX Companion},
    edition = {1},
    publisher = {Addison-Wesley},
    location = {Reading, Mass.},
    year = {1994},
    }
    @Book{adams,
    title = {The Restaurant at the End of the Universe},
    author = {Douglas Adams},
    series = {The Hitchhiker's Guide to the Galaxy},
    publisher = {Pan Macmillan},
    year = {1980},
    }
    @article{einstein,
    author = {Albert Einstein},
    title = {{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
    [{On} the electrodynamics of moving bodies]},
    journal = {Annalen der Physik},
    volume = {322}, 
    }

This generates a bibliography and a footnote citation for all references in the document. And only the referenced ones with \cite{ref1} apear in the end Bibliography. This is my next question. -> Full bibliography does not show the not referenced citations in Document

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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