我正在整理我的简历。我的 MWE 是:
\documentclass[12pt]{article}
\usepackage{array, xcolor, bibentry, longtable}
\usepackage[margin=3cm]{geometry}
\usepackage[english]{babel}
\title{\bfseries\Huge My name}
\author{\large{\textbf{\textit{February 2019}}}}
\date{}
\definecolor{lightgray}{gray}{0.8}
\newcolumntype{L}{>{\raggedleft}p{0.14\textwidth}}
\newcolumntype{R}{p{0.85\textwidth}}
\newcommand\VRule{\color{lightgray}\vrule width 0.5pt}
\begin{filecontents}{my2.bib}
@book{bnm,
title={Title},
author={Author, 1 and Author, 2},
publisher={Cambridge University Press},
address={Cambridge}
}
\end{filecontents}
\begin{document}
\maketitle
\vspace{20pt}
\section*{Personal Information}
Date of Birth: XXXX\\[7pt]
Citizenship: XXXX\\[7pt]
\begin{minipage}{\textwidth}
Address:
\begin{tabular}[t]{@{}l@{}}
Mine in my city,\\
in my place
\end{tabular}
\end{minipage}\\[7pt]
Phone: +39 123 45678\\[7pt]
\begin{minipage}{\textwidth}
Email:
\begin{tabular}[t]{@{}l@{}}\medskip \smallskip
[email protected]\\
[email protected]
\end{tabular}
\end{minipage}\\[7pt]
Personal website: www.mysite.com
\section*{Education}
\begin{longtable}{L!{\VRule}R}
2008&{Ph.D. in Economics}\\
&Supervisor: My friend \\
& Thesis: My title\\
& Thesis committee: ABC; DEF\\[5pt]
\end{longtable}
\bibliographystyle{plain}
\nobibliography{my2}
\section*{Research}
\subsection*{\it Main publications}
\subsection*{\it Books}
\begin{longtable}{L!{\VRule}R}
2014&\bibentry{bnm}\\
\end{longtable}
\section*{References}
Upon request.
\end{document}
一切正常。我想让我的网站和电子邮件地址可点击。因此我加载了包hyperref
。但是当我这样做时,我在编译时收到以下错误消息:
! LaTeX Error: Lonely \item--perhaps a missing list environment.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.3 \bibitem{bnm}
显然,参考文献列表和附加包之间存在冲突hyperref
。
有什么办法可以解决这个问题吗?也许,另一个包裹?提前致谢。
编辑
这些是日志文件的前几行:
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6840)
entering extended mode
我使用 TeXworks v. 0.6.2 (MikTex 2.9.6840)
第二次更新
我更新了我的版本,但问题仍然存在。这是日志文件的第一行:
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6930)
entering extended mode
第三次更新
我也以用户身份更新了 MikTeX,但问题仍然存在。
这是完整的日志文件(使用后\listfiles
)
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6930)
entering extended mode
("C:/Users/Dario/Desktop/Nuova cartella/prova2.tex"
LaTeX2e <2018-12-01>
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/base\article.cls"
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/base\size12.clo"))
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/tools\array.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/xcolor\xcolor.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/graphics-cfg\color.cfg")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/graphics-def\pdftex.def"))
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/natbib\bibentry.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/tools\longtable.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/geometry\geometry.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/graphics\keyval.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/oberdiek\ifpdf.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/oberdiek\ifvtex.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/ifxetex\ifxetex.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/geometry\geometry.cfg"))
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/babel\babel.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/babel\switch.def")
*************************************
* Local config file bblopts.cfg used
*
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/arabi\bblopts.cfg")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/babel-english\english.ldf"
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/babel\babel.def"
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/babel\txtbabel.def"))))
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/hyperref\hyperref.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/oberdiek\hobsub-hyperref.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/oberdiek\hobsub-generic.sty"))
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/oberdiek\auxhook.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/oberdiek\kvoptions.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/hyperref\pd1enc.def")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/00miktex\hyperref.cfg")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/url\url.sty"))
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/hyperref\hpdftex.def"
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/oberdiek\rerunfilecheck.sty"))
LaTeX Warning: Writing file `./my2.bib'.
No file prova2.aux.
("C:\Program Files (x86)\MiKTeX 2.9\tex/context/base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
)
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/hyperref\nameref.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/oberdiek\gettitlestring.sty"))
Overfull \hbox (20.06664pt too wide) in alignment at lines 56--61
[] []
No file prova2.bbl.
LaTeX Warning: Citation `bnm' undefined on input line 69.
Overfull \hbox (20.06664pt too wide) in alignment at lines 68--70
[] []
[1{C:/Users/Dario/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}] [2]
(prova2.aux)
*File List*
article.cls 2018/09/03 v1.4i Standard LaTeX document class
size12.clo 2018/09/03 v1.4i Standard LaTeX file (size option)
array.sty 2018/12/30 v2.4k Tabular extension package (FMi)
xcolor.sty 2016/05/11 v2.12 LaTeX color extensions (UK)
color.cfg 2016/01/02 v1.6 sample color configuration
pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
bibentry.sty 2007/10/30 1.5 (PWD)
longtable.sty 2014/10/28 v4.11 Multi-page Table package (DPC)+ FMi change
geometry.sty 2018/04/16 v5.8 Page Geometry
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
geometry.cfg
babel.sty 2018/11/13 3.27 The Babel package
bblopts.cfg 2005/09/08 v0.1 add Arabic and Farsi to "declared" options of b
abel
english.ldf 2017/06/06 v3.3r English support from the babel system
hyperref.sty 2018/11/30 v6.88e Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2018/11/30 v6.88e Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hpdftex.def 2018/11/30 v6.88e Hyperref driver for pdfTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
supp-pdf.mkii
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
***********
Package rerunfilecheck Warning: File `prova2.out' has changed.
(rerunfilecheck) Rerun to get outlines right
(rerunfilecheck) or use package `bookmark'.
LaTeX Warning: There were undefined references.
)
(see the transcript file for additional information)<C:/Program Files (x86)/MiK
TeX 2.9/fonts/type1/public/amsfonts/cm/cmbx12.pfb><C:/Program Files (x86)/MiKTe
X 2.9/fonts/type1/public/amsfonts/cm/cmbxti10.pfb><C:/Program Files (x86)/MiKTe
X 2.9/fonts/type1/public/amsfonts/cm/cmr12.pfb><C:/Program Files (x86)/MiKTeX 2
.9/fonts/type1/public/amsfonts/cm/cmti12.pfb>
Output written on prova2.pdf (2 pages, 52366 bytes).
SyncTeX written on prova2.synctex.gz.
Transcript written on prova2.log.
This is BibTeX, Version 0.99d (MiKTeX 2.9.6930)
The top-level auxiliary file: prova2.aux
The style file: plain.bst
Database file #1: my2.bib
Warning--empty year in bnm
(There was 1 warning)
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6930)
entering extended mode
("C:/Users/Dario/Desktop/Nuova cartella/prova2.tex"
LaTeX2e <2018-12-01>
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/base\article.cls"
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/base\size12.clo"))
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/tools\array.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/xcolor\xcolor.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/graphics-cfg\color.cfg")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/graphics-def\pdftex.def"))
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/natbib\bibentry.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/tools\longtable.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/geometry\geometry.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/graphics\keyval.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/oberdiek\ifpdf.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/oberdiek\ifvtex.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/ifxetex\ifxetex.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/geometry\geometry.cfg"))
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/babel\babel.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/babel\switch.def")
*************************************
* Local config file bblopts.cfg used
*
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/arabi\bblopts.cfg")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/babel-english\english.ldf"
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/babel\babel.def"
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/babel\txtbabel.def"))))
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/hyperref\hyperref.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/oberdiek\hobsub-hyperref.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/oberdiek\hobsub-generic.sty"))
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/oberdiek\auxhook.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/oberdiek\kvoptions.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/hyperref\pd1enc.def")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/00miktex\hyperref.cfg")
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/url\url.sty"))
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/hyperref\hpdftex.def"
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/oberdiek\rerunfilecheck.sty"))
LaTeX Warning: File `my2.bib' already exists on the system.
Not generating it from this source.
(prova2.aux) ("C:\Program Files (x86)\MiKTeX 2.9\tex/context/base\supp-pdf.mkii
"
[Loading MPS to PDF converter (version 2006.09.02).]
)
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
("C:\Program Files (x86)\MiKTeX 2.9\tex/latex/hyperref\nameref.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex/generic/oberdiek\gettitlestring.sty"))
(prova2.out) (prova2.out)
Overfull \hbox (20.06664pt too wide) in alignment at lines 56--61
[] []
(prova2.bbl
! LaTeX Error: Lonely \item--perhaps a missing list environment.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.3 \bibitem{bnm}
?
请注意,我的 tex 文件的名称是prova2.tex
。
答案1
您的代码存在问题,您忘记调用包natbib
(请注意,这bibentry
是 的一部分natbib
)。因此,您必须将 bib 样式从 更改plain
为plainnat
。
包裹hyperref
在您的情况下,应该最后调用
因此,请参阅以下代码(代码更改以 标记<=====
):
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{bnm,
title = {Title},
author = {Author, One and Author, Two},
publisher = {Cambridge University Press},
address = {Cambridge},
year = {2014},
}
\end{filecontents}
\listfiles
\documentclass[12pt]{article}
\usepackage[margin=3cm]{geometry}
\usepackage[english]{babel}
\usepackage{array, xcolor, longtable}
\usepackage{natbib} % <=================================================
\usepackage{bibentry}
\usepackage{hyperref} % <===================================[colorlinks]
\title{\bfseries\Huge My name}
\author{\large{\textbf{\textit{February 2019}}}}
\date{}
\definecolor{lightgray}{gray}{0.8}
\newcolumntype{L}{>{\raggedleft}p{0.14\textwidth}}
\newcolumntype{R}{p{0.84\textwidth}}
\newcommand\VRule{\color{lightgray}\vrule width 0.5pt}
\begin{document}
\maketitle
\vspace{20pt}
\section*{Personal Information}
Date of Birth: XXXX\\[7pt]
Citizenship: XXXX\\[7pt]
\begin{minipage}{\textwidth}
Address:
\begin{tabular}[t]{@{}l@{}}
Mine in my city,\\
in my place
\end{tabular}
\end{minipage}\\[7pt]
Phone: +39 123 45678\\[7pt]
\begin{minipage}{\textwidth}
Email:
\begin{tabular}[t]{@{}l@{}}\medskip \smallskip
\href{mailto:[email protected]}{[email protected]}\\ % <==============
\href{mailto:[email protected]}{[email protected]} % <================
\end{tabular}
\end{minipage}\\[7pt]
Personal website: \url{www.mysite.com} % <==============================
\section*{Education}
\begin{longtable}{L!{\VRule}R}
2008&{Ph.D. in Economics}\\
&Supervisor: My friend \\
& Thesis: My title\\
& Thesis committee: ABC; DEF\\[5pt]
\end{longtable}
\bibliographystyle{plainnat} % plain
\nobibliography{\jobname}
\section*{Research}
\subsection*{\it Main publications}
\subsection*{\it Books}
\begin{longtable}{L!{\VRule}R}
2014&\bibentry{bnm}\\
\end{longtable}
\section*{References}
Upon request.
\end{document}
及其结果:
答案2
对我来说是有效的。请确保在再次编译之前删除所有临时文件
\documentclass[12pt]{article}
\usepackage{array, xcolor, bibentry, longtable}
\usepackage[margin=3cm]{geometry}
\usepackage[english]{babel}
%%
\usepackage[
colorlinks,
linkcolor={red!50!black},
citecolor={blue!50!black},
urlcolor={blue!80!black}
]{hyperref}
%%
\title{\bfseries\Huge My name}
\author{\large{\textbf{\textit{February 2019}}}}
\date{}
\definecolor{lightgray}{gray}{0.8}
\newcolumntype{L}{>{\raggedleft}p{0.14\textwidth}}
\newcolumntype{R}{p{0.85\textwidth}}
\newcommand\VRule{\color{lightgray}\vrule width 0.5pt}
\begin{filecontents}{my2.bib}
@book{bnm,
title={Title},
author={Author, 1 and Author, 2},
publisher={Cambridge University Press},
address={Cambridge}
}
\end{filecontents}
\begin{document}
\maketitle
\vspace{20pt}
\section*{Personal Information}
Date of Birth: XXXX\\[7pt]
Citizenship: XXXX\\[7pt]
\begin{minipage}{\textwidth}
Address:
\begin{tabular}[t]{@{}l@{}}
Mine in my city,\\
in my place
\end{tabular}
\end{minipage}\\[7pt]
Phone: +39 123 45678\\[7pt]
\begin{minipage}{\textwidth}
Email:
\begin{tabular}[t]{@{}l@{}}\medskip \smallskip
\href{mailto:[email protected]}{[email protected]}\\
\href{mailto:[email protected]}{[email protected]}
\end{tabular}
\end{minipage}\\[7pt]
Personal website: \href{www.mysite.com}{www.mysite.com}
\section*{Education}
\begin{longtable}{L!{\VRule}R}
2008&{Ph.D. in Economics}\\
&Supervisor: My friend \\
& Thesis: My title\\
& Thesis committee: ABC; DEF\\[5pt]
\end{longtable}
\bibliographystyle{plain}
\nobibliography{my2}
\section*{Research}
\subsection*{\it Main publications}
\subsection*{\it Books}
\begin{longtable}{L!{\VRule}R}
2014&\bibentry{bnm}\\
\end{longtable}
\section*{References}
Upon request.
\end{document}