Bug fix: fixed error when no bibliographic files were found and nobib

is not specified. Instead of a hard to trace "missing item",
         this is now an intentional error.
This commit is contained in:
Achim D. Brucker 2018-03-04 12:45:32 +00:00
parent 44e88520a3
commit 0de7c898cb
1 changed files with 52 additions and 33 deletions

View File

@ -91,6 +91,19 @@
\newlength\AA@y \newlength\AA@y
\newlength\AA@width \newlength\AA@width
\def\AA@bibBibTeX{\AA@bibtexdir/\AA@key.bib}
\def\AA@bibWord{\AA@bibtexdir/\AA@key.word.xml}
\def\AA@bibEndnote{\AA@bibtexdir/\AA@key.enw}
\def\AA@bibRIS{\AA@bibtexdir/\AA@key.ris}
\newboolean{AA@bibExists}
\setboolean{AA@bibExists}{false}
\IfFileExists{\AA@bibBibTeX}{\setboolean{AA@bibExists}{true}}{}
\IfFileExists{\AA@bibWord}{\setboolean{AA@bibExists}{true}}{}
\IfFileExists{\AA@bibEndnote}{\setboolean{AA@bibExists}{true}}{}
\IfFileExists{\AA@bibRIS}{\setboolean{AA@bibExists}{true}}{}
\setlength\AA@x{1in+\hoffset+\oddsidemargin} \setlength\AA@x{1in+\hoffset+\oddsidemargin}
\newcommand{\authorcrfont}{\footnotesize} \newcommand{\authorcrfont}{\footnotesize}
@ -248,62 +261,68 @@
\fi \fi
\fi \fi
\ifAA@nobib\relax\else% \ifAA@nobib\relax\else%
\hfill \ifthenelse{\boolean{AA@bibExists}}{%
% We need "doubleprint", because the text of \textattachfile is not printed when printing a PDF \hfill
% We use the idea from https://tex.stackexchange.com/a/19045/9075, accepting that % We need "doubleprint", because the text of \textattachfile
% the pointers to the files are renderedin semi-bold way % is not printed when printing a PDF
\newlength{\Urlname} % We use the idea from
\newcommand{\doubleprint}[1]{\setlength{\Urlname}{\widthof{#1}}\hspace{-\Urlname}#1} % https://tex.stackexchange.com/a/19045/9075, accepting that
\begin{itemize*}[label={}, itemjoin={,}] % the pointers to the files are renderedin semi-bold way
\IfFileExists{\AA@bibtexdir/\AA@key.bib}{% \newlength{\Urlname}
\item \textattachfile[% \newcommand{\doubleprint}[1]{\setlength{\Urlname}{\widthof{#1}}\hspace{-\Urlname}#1}
\begin{itemize*}[label={}, itemjoin={,}]
\IfFileExists{\AA@bibBibTeX}{%
\item \textattachfile[%
print=true,% print=true,%
color=0 0 0,% color=0 0 0,%
icon=Paperclip,% icon=Paperclip,%
description={BibTeX entry of this paper},% description={BibTeX entry of this paper},%
mimetype=application/x-bibtex% mimetype=application/x-bibtex%
]{\AA@bibtexdir/\AA@key.bib}{\BibTeX}% ]{\AA@bibBibTeX}{\BibTeX}%
\doubleprint{\BibTeX} \doubleprint{\BibTeX}
}{ }{
\typeout{No file \AA@bibtexdir/\AA@key.bib found. Not embedded reference in BibTeX format.} \typeout{No file \AA@bibBibTeX found. Not embedded reference in BibTeX format.}
} }
\IfFileExists{\AA@bibtexdir/\AA@key.word.xml}{% \IfFileExists{\AA@bibWord}{%
\item \textattachfile[% \item \textattachfile[%
print=true,% print=true,%
color=0 0 0,% color=0 0 0,%
icon=Paperclip,% icon=Paperclip,%
description={XML entry of this paper (e.g., for Word 2007 and later)},% description={XML entry of this paper (e.g., for Word 2007 and later)},%
mimetype=application/xml% mimetype=application/xml%
]{\AA@bibtexdir/\AA@key.word.xml}{Word}% ]{\AA@bibWord}{Word}%
\doubleprint{Word} \doubleprint{Word}
}{ }{
\typeout{No file \AA@bibtexdir/\AA@key.word.xml found. Not embedded reference for Word 2007 and later.} \typeout{No file \AA@bibWord found. Not embedded reference for Word 2007 and later.}
} }
\IfFileExists{\AA@bibtexdir/\AA@key.enw}{% \IfFileExists{\AA@bibEndnote}{%
\item \textattachfile[% \item \textattachfile[%
print=true,% print=true,%
color=0 0 0,% color=0 0 0,%
icon=Paperclip,% icon=Paperclip,%
description={Endnote entry of this paper},% description={Endnote entry of this paper},%
mimetype=application/x-endnote-refer% mimetype=application/x-endnote-refer%
]{\AA@bibtexdir/\AA@key.enw}{EndNote}% ]{\AA@bibEndnote}{EndNote}%
\doubleprint{EndNote} \doubleprint{EndNote}
}{ }{
\typeout{No file \AA@bibtexdir/\AA@key.enw found. Not embedded reference in Endnote format.} \typeout{No file \AA@bibEndnote found. Not embedded reference in Endnote format.}
} }
\IfFileExists{\AA@bibtexdir/\AA@key.ris}{% \IfFileExists{\AA@bibRIS}{%
\item \textattachfile[% \item \textattachfile[%
print=true,% print=true,%
color=0 0 0,% color=0 0 0,%
icon=Paperclip,% icon=Paperclip,%
description={RIS entry of this paper},% description={RIS entry of this paper},%
mimetype=application/x-research-info-systems% mimetype=application/x-research-info-systems%
]{\AA@bibtexdir/\AA@key.ris}{RIS}% ]{\AA@bibRIS}{RIS}%
\doubleprint{RIS} \doubleprint{RIS}
}{ }{
\typeout{No file \AA@bibtexdir/\AA@key.ris found. Not embedded reference in RIS format.} \typeout{No file \AA@bibRIS found. Not embedded reference in RIS format.}
} }
\end{itemize*} \end{itemize*}%
}{%
\PackageError{authorarchive}{No bibliographic files found. Specify option 'nobib' if this is intended.}
}
\fi \fi
} }
} }