I have a main.tex file which is including other tex files in order to have a better overview over my file. Here is how the main.tex looks like:
\documentclass[a4paper,10pt, twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[english]{babel}
\date{}
\graphicspath{{../figures/}}
\newcommand\Mycite[1]{%
(\citeauthor{#1},~\citeyear{#1})}
\begin{document}
\nocite{*}
\input{second_latex_file}
\bibliographystyle{plain}
\bibliography{literature}
\end{document}
and in the second_latex_file.tex I am trying to use the defined command Mycite, but I am still getting the error "undefined control sequence Mycite..
The file second_latex_file.tex has no preambles, it just starts with a text! So like:
\chapter{Second chapter}
......some text here
.... \Mycite{something}
I tried to copy the command into this file, but of course then I get the error message "command already defined". Does someone know what I have to do in this case :S?
Best Answer
you need
\usepackage{natbib}
for\citeauthor
and\citeyear
to work