我正在使用 moderncv 和 moderntimeline 包编写简历。我希望出版物列表按倒序编号,从最新到最旧排序,以便在 moderncv 左栏中显示出版物标签编号和 moderntimeline 图片。弗朗索瓦·穆顿提供了现代时间轴与书目的首次集成(我从那里开始),但他的代码不适用于数字书目样式。也许数字加时间轴很丑陋,但我被强烈建议这样做,因此我必须遵守。
我尝试重新定义参考书目环境,在左列中包含数字标签和时间线,并定义一个新命令,\tldatecventryV
该命令创建长度为 的时间线\hintscolumnwidthV
(基于模板长度\hintscolumnwidth
),并且除了年份和颜色之外没有其他参数(因此它只创建时间线图片)。为了重新定义参考书目缩进,我使用了答案 biblatex 参考书目列表的左边距对齐和 将 biblatex 标签移至边缘并随机改变一些我不太理解的东西。
反向编号来自biblatex:反向编号(即倒数)。
\documentclass[sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{orange}
\usepackage[scale=0.75]{geometry}
\usepackage{moderntimeline}
\tlmaxdates{1888}{1929}
\usepackage[backend = biber,
style = nature,
sorting = none
]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Article{Jones1929,
author = {Jones, Grinnell and Dole, Malcolm},
title = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
journaltitle = {J. Am. Chem. Soc.},
date = {1929},
volume = {51},
number = {10},
pages = {2950--2964},
doi = {10.1021/ja01385a012}
}
@Article{Drude1894,
author = {Drude, P. and Nernst, W.},
title = {{\"U}ber Elektrostriktion durch freie Ionen},
journaltitle = {Z. Phys. Chem.},
date = {1894},
volume = {15},
pages = {79--85},
}
@Article{Hofmeister1888,
author = {Hofmeister, Franz},
title = {Zur Lehre von der Wirkung der Salze},
journaltitle = {Arch. Exp. Pathol. Pharmakol.},
date = {1888},
volume = {25},
number = {1},
pages = {1--30},
doi = {10.1007/BF01838161},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
%-----------------------------------------------------------
\newlength{\hintscolumnwidthV}
\setlength{\hintscolumnwidthV}{.7\hintscolumnwidth}
\makeatletter
\newcommand*{\cventryV}[1][.25em]{}
% for numeric bibliography
\newcommand{\tldatecventryV}[2][color1]{%
\issincefalse
\tl@formatstartyear{#2}
\cventryV{\tikz[baseline=0pt]{
\useasboundingbox (2ex,0ex) rectangle (\hintscolumnwidthV,1ex);
\fill [\tl@runningcolor] (0,0)
rectangle (\hintscolumnwidthV,\tl@runningwidth);
\fill [#1] (0,0)
++(\tl@startfraction*\hintscolumnwidthV,0pt)
node [tl@singleyear] {#2}
node {$\bullet$};
}}}
\makeatother
% 'numeric' bibliography environment (from numeric.bbx)
\defbibenvironment{bibliography}
{\list
{\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{labelnumber}}
\tldatecventryV{%
\thefield{year} % actual year from bibitem
}}
{\setlength{\topsep}{0pt}% layout parameters based on moderncvstyleclassic.sty
\setlength{\labelwidth}{\hintscolumnwidth}%
\setlength{\labelsep}{\separatorcolumnwidth}%
\setlength{\itemsep}{\bibitemsep}%
\leftmargin\labelwidth%
\addtolength{\leftmargin}{-.35\labelsep}% <-- changed
\advance\leftmargin\labelsep
}%
\sloppy\clubpenalty4000\widowpenalty4000}
{\endlist}
{\item}
%-----------------------
\AtEveryBibitem{\clearfield{year}}
%-------------------------------------------------------------------------------
% reverse numbering of publications
%-------------------------------------------------------------------------------
% Count total number of entries in each refsection
\AtDataInput{%
\csnumgdef{entrycount:\therefsection}{%
\csuse{entrycount:\therefsection}+1}}
% Print the labelnumber as the total number of entries in the
% current refsection, minus the actual labelnumber, plus one
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}
\newrobustcmd*{\mkbibdesc}[1]{%
\number\numexpr\csuse{entrycount:\therefsection}+1-#1\relax}
%------------------- Personal Data for CV header -------------------------------
\name{Joan}{Doe}
%-------------------------------------------------------------------------------
\begin{document}
\makecvtitle
\nocite{*}
\printbibliography[type=article,title={Journal Publications}]
\end{document}
它产生了这个:
我的第一个问题是,是否可以以一种比我随意摆弄更合理的方式来定义各种长度。也许这样它就可以自动调整为其他数字书目格式?
我的第二个问题是,我还想保留快速切换到非数字书目格式的可能性(而不使用 Mouton 的解决方案,因为它存在一些缩进问题)。我整理了一些适用于 authoryear 的东西:
\documentclass[sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{orange}
\usepackage[scale=0.75]{geometry}
\usepackage{moderntimeline}
\tlmaxdates{1888}{1929}
\usepackage[backend = biber,
style = authoryear,
sorting = none % ydnt
]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Article{Jones1929,
author = {Jones, Grinnell and Dole, Malcolm},
title = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
journaltitle = {J. Am. Chem. Soc.},
date = {1929},
volume = {51},
number = {10},
pages = {2950--2964},
doi = {10.1021/ja01385a012}
}
@Article{Drude1894,
author = {Drude, P. and Nernst, W.},
title = {{\"U}ber Elektrostriktion durch freie Ionen},
journaltitle = {Z. Phys. Chem.},
date = {1894},
volume = {15},
pages = {79--85},
}
@Article{Hofmeister1888,
author = {Hofmeister, Franz},
title = {Zur Lehre von der Wirkung der Salze},
journaltitle = {Arch. Exp. Pathol. Pharmakol.},
date = {1888},
volume = {25},
number = {1},
pages = {1--30},
doi = {10.1007/BF01838161},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
%-----------------------------------------------------------
\newlength{\hintscolumnwidthV}
\setlength{\hintscolumnwidthV}{.7\hintscolumnwidth}
\makeatletter
\newcommand*{\cventryV}[1][.25em]{}
% for general bibliography
\newcommand{\tldatecventryVn}[2][color1]{%
\issincefalse
\tl@formatstartyear{#2}
\cventryV{\tikz[baseline=0pt]{
\useasboundingbox (10ex,0) rectangle (\hintscolumnwidth,1ex);
\fill [\tl@runningcolor] (0,0)
rectangle (\hintscolumnwidth,\tl@runningwidth);%%V
\fill [#1] (0,0)
++(\tl@startfraction*\hintscolumnwidth,0pt)
node [tl@singleyear] {#2}
node {$\bullet$};
}}}
\makeatother
\defbibenvironment{bibliography}
{\list
{\tldatecventryVn{%
\thefield{year} % actual year from bibitem
}}%
{\leftmargin\bibhang
\itemindent\leftmargin
\setlength{\labelwidth}{\hintscolumnwidth}
\setlength{\labelsep}{\separatorcolumnwidth}%
\itemsep\bibitemsep
\addtolength{\leftmargin}{6.6\labelsep}
\advance\itemindent-\labelsep
\parsep\bibparsep}}
{\endlist}
{\item}
%-----------------------
\AtEveryBibitem{\clearfield{year}}
%-------------------------------------------------------------------------------
% reverse numbering of publications
%-------------------------------------------------------------------------------
% Count total number of entries in each refsection
\AtDataInput{%
\csnumgdef{entrycount:\therefsection}{%
\csuse{entrycount:\therefsection}+1}}
% Print the labelnumber as the total number of entries in the
% current refsection, minus the actual labelnumber, plus one
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}
\newrobustcmd*{\mkbibdesc}[1]{%
\number\numexpr\csuse{entrycount:\therefsection}+1-#1\relax}
%------------------- Personal Data for CV header -------------------------------
\name{Joan}{Doe}
%-------------------------------------------------------------------------------
\begin{document}
\makecvtitle
\nocite{*}
\printbibliography[type=article,title={Journal Publications}]
\end{document}
但是,除了更好地定义长度的问题之外,我不知道如何在两个选项之间自动切换 - 现在我在同一个文件中同时拥有这两个选项,并且我注释/取消注释了数字书目环境定义。也许还有一种更简单的方法来完成所有这些工作。
更新——11月15日
感谢@Astrinus 的建议,我得到了这个:
\documentclass[sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{orange}
\usepackage[scale=0.75]{geometry}
\usepackage{moderntimeline}
\tlmaxdates{1886}{1931}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Article{Jones1929,
author = {Jones, Grinnell and Dole, Malcolm},
title = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
journaltitle = {J. Am. Chem. Soc.},
date = {1929},
volume = {51},
number = {10},
pages = {2950--2964},
doi = {10.1021/ja01385a012}
}
@Article{Drude1894,
author = {Drude, P. and Nernst, W.},
title = {{\"U}ber Elektrostriktion durch freie Ionen},
journaltitle = {Z. Phys. Chem.},
date = {1894},
volume = {15},
pages = {79--85}
}
@Article{Hofmeister1888,
author = {Hofmeister, Franz},
title = {Zur Lehre von der Wirkung der Salze},
journaltitle = {Arch. Exp. Pathol. Pharmakol.},
date = {1888},
volume = {25},
number = {1},
pages = {1--30},
doi = {10.1007/BF01838161}
}
@Article{Jones19292,
author = {Jones, Grinnell and Dole, Malcolm},
title = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
journaltitle = {J. Am. Chem. Soc.},
date = {1929},
volume = {51},
number = {10},
pages = {2950--2964},
doi = {10.1021/ja01385a012}
}
@Article{Drude18942,
author = {Drude, P. and Nernst, W.},
title = {{\"U}ber Elektrostriktion durch freie Ionen},
journaltitle = {Z. Phys. Chem.},
date = {1894},
volume = {15},
pages = {79--85}
}
@Article{Hofmeister18882,
author = {Hofmeister, Franz},
title = {Zur Lehre von der Wirkung der Salze},
journaltitle = {Arch. Exp. Pathol. Pharmakol.},
date = {1888},
volume = {25},
number = {1},
pages = {1--30},
doi = {10.1007/BF01838161}
}
@Article{Jones19293,
author = {Jones, Grinnell and Dole, Malcolm},
title = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
journaltitle = {J. Am. Chem. Soc.},
date = {1929},
volume = {51},
number = {10},
pages = {2950--2964},
doi = {10.1021/ja01385a012}
}
@Article{Drude18943,
author = {Drude, P. and Nernst, W.},
title = {{\"U}ber Elektrostriktion durch freie Ionen},
journaltitle = {Z. Phys. Chem.},
date = {1894},
volume = {15},
pages = {79--85}
}
@Article{Hofmeister18883,
author = {Hofmeister, Franz},
title = {Zur Lehre von der Wirkung der Salze},
journaltitle = {Arch. Exp. Pathol. Pharmakol.},
date = {1888},
volume = {25},
number = {1},
pages = {1--30},
doi = {10.1007/BF01838161}
}
@Article{Jones19294,
author = {Jones, Grinnell and Dole, Malcolm},
title = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
journaltitle = {J. Am. Chem. Soc.},
date = {1929},
volume = {51},
number = {10},
pages = {2950--2964},
doi = {10.1021/ja01385a012}
}
@Article{Drude18944,
author = {Drude, P. and Nernst, W.},
title = {{\"U}ber Elektrostriktion durch freie Ionen},
journaltitle = {Z. Phys. Chem.},
date = {1894},
volume = {15},
pages = {79--85}
}
@Article{Hofmeister18884,
author = {Hofmeister, Franz},
title = {Zur Lehre von der Wirkung der Salze},
journaltitle = {Arch. Exp. Pathol. Pharmakol.},
date = {1888},
volume = {25},
number = {1},
pages = {1--30},
doi = {10.1007/BF01838161}
}
\end{filecontents*}
%-----------------------------------------------------------
\newif\ifnumericCVbibliography
\numericCVbibliographytrue % replace true with false to disable
\newlength{\hintscolumnwidthV}
\setlength\hintscolumnwidthV{\hintscolumnwidth}
\newlength{\labelkern}
\ifnumericCVbibliography
\setlength\labelkern{-2ex}
\usepackage[backend = biber,
style = nature,
sorting = none
]{biblatex}
\newcommand{\printbibnumber}{%\hspace* here has no effect so I removed it
\llap{\printtext[labelnumberwidth]{%
\printfield{labelprefix}%
\printfield{labelnumber}
}\kern\labelkern% to reduce space between label and timeline image
}%
}
\else
\usepackage[backend = biber,
style = authoryear,
sorting = none
]{biblatex}
\newcommand{\printbibnumber}{\relax} % do nothing
\setlength\labelkern{0ex}
\setlength\hintscolumnwidthV{\hintscolumnwidth} % this length needs
% to be re-set or it keeps the numeric version value if that has been run before
\fi
\addbibresource{\jobname.bib}
%-----------------------------------------------------------
\makeatletter
\newcommand*{\cventryV}[1][.25em]{}
% timeline for bibliography
\newcommand{\tldatecventryV}[2][color1]{%
\issincefalse
\tl@formatstartyear{#2}
\cventryV{\tikz[baseline=0pt]{
\useasboundingbox (0ex,0ex) rectangle (\hintscolumnwidthV,1ex);
%changed origin of boundingbox. previous was (2ex,0ex) but this
% creates alignment problems when switching between numeric and non numeric.
\fill [\tl@runningcolor] (0,0)
rectangle (\hintscolumnwidthV,\tl@runningwidth);
\fill [#1] (0,0)
++(\tl@startfraction*\hintscolumnwidthV,0pt)
node [tl@singleyear] {#2}
node {$\bullet$};
}}}
\makeatother
%-----------------------------------
\defbibenvironment{bibliography}
{\list
{\printbibnumber% here you see the macro in action
\tldatecventryV{%
\thefield{year} % actual year from bibitem
}}
{%
\setlength{\topsep}{0pt}% layout parameters based on moderncvstyleclassic.sty
\addtolength\hintscolumnwidthV{-\labelnumberwidth}% num - changes timeline image length
\addtolength\hintscolumnwidthV{\labelkern}% num - changes timeline image length
\setlength{\bibhang}{\hintscolumnwidthV} % custom bibhang
\setlength{\labelsep}{\separatorcolumnwidth} % horizontal distance between label and entry
\setlength{\leftmargin}{\hintscolumnwidth} % sets where the left margin is
\addtolength{\leftmargin}{\separatorcolumnwidth} %
\setlength{\itemindent}{-\bibhang} % this sets indentation of the second line of the entry.
% changing it moves also the first line left or right
\addtolength{\itemindent}{-\separatorcolumnwidth} % to align the second line exactly
\setlength{\itemsep}{\bibitemsep} % vertical distance between bib items
\setlength{\parsep}{\bibparsep}}}
{\endlist}
{\item}
%-----------------------
\AtEveryBibitem{\clearfield{year}}
%-------------------------------------------------------------------------------
% reverse numbering of publications
%-------------------------------------------------------------------------------
% Count total number of entries in each refsection
\AtDataInput{%
\csnumgdef{entrycount:\therefsection}{%
\csuse{entrycount:\therefsection}+1}}
% Print the labelnumber as the total number of entries in the
% current refsection, minus the actual labelnumber, plus one
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}
\newrobustcmd*{\mkbibdesc}[1]{%
\number\numexpr\csuse{entrycount:\therefsection}+1-#1\relax}
%------------------- Personal Data for CV header -------------------------------
\name{Joan}{Doe}
%-------------------------------------------------------------------------------
\begin{document}
\makecvtitle
\nocite{*}
\printbibliography[type=article,title={Journal Publications}]
\end{document}
对于@Astrinus 的回答,我调整了 bibitem 的间距和缩进,试图使它们在数字和非数字书目样式之间保持一致。(并进行了更改\def
-\newcommand
我已经用这些编辑了 Astrinus 的答案)。我不确定这是否是定义长度的最佳方式,也不确定这是否是调整模板的一般方式(即更改字体时),我很高兴收到有关书目中长度定义的建议和评论。
\numericCVbibliographytrue
这些是使用 MWE 对数字( )和非数字( )样式得到的结果\numericCVbibliographyfalse
:
答案1
你可以写类似的东西
\newif\ifnumericCVbibliography
\numericCVbibliographytrue % replace true with false to disable
\newlength{\hintscolumnwidthV}
\setlength\hintscolumnwidthV{\hintscolumnwidth}
\ifnumericCVbibliography
\usepackage[backend = biber,
style = nature,
sorting = none
]{biblatex}
\def\printbibnumber{\hspace*{1.5em}%
\llap{\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{labelnumber}%
}%
}%
}
\addtolength\hintscolumnwidthV{-1.75em}
\else
\usepackage[backend = biber,
style = authoryear,
sorting = none
]{biblatex}
\def\printbibnumber\relax
\fi
然后使用\printnumber
你的之前的宏\tldatecventryV
。
\hspace{1.5em}
为两位数腾出了空间。
完整(我希望可以工作)的示例:
\documentclass[sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{orange}
\usepackage[scale=0.75]{geometry}
\usepackage{moderntimeline}
\tlmaxdates{1888}{1929}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Article{Jones1929,
author = {Jones, Grinnell and Dole, Malcolm},
title = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
journaltitle = {J. Am. Chem. Soc.},
date = {1929},
volume = {51},
number = {10},
pages = {2950--2964},
doi = {10.1021/ja01385a012}
}
@Article{Drude1894,
author = {Drude, P. and Nernst, W.},
title = {{\"U}ber Elektrostriktion durch freie Ionen},
journaltitle = {Z. Phys. Chem.},
date = {1894},
volume = {15},
pages = {79--85},
}
@Article{Hofmeister1888,
author = {Hofmeister, Franz},
title = {Zur Lehre von der Wirkung der Salze},
journaltitle = {Arch. Exp. Pathol. Pharmakol.},
date = {1888},
volume = {25},
number = {1},
pages = {1--30},
doi = {10.1007/BF01838161},
}
\end{filecontents*}
%-----------------------------------------------------------
\newif\ifnumericCVbibliography
\numericCVbibliographytrue % replace true with false to disable
\newlength{\hintscolumnwidthV}
\setlength\hintscolumnwidthV{\hintscolumnwidth}
\ifnumericCVbibliography
\usepackage[backend = biber,
style = nature,
sorting = none
]{biblatex}
\def\printbibnumber{\hspace*{1.5em}%
\llap{\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{labelnumber}%
}%
}%
}
\addtolength\hintscolumnwidthV{-1.75em}
\else
\usepackage[backend = biber,
style = authoryear,
sorting = none
]{biblatex}
\def\printbibnumber\relax % do nothing
\fi
\addbibresource{\jobname.bib}
%-----------------------------------------------------------
\makeatletter
\newcommand*{\cventryV}[1][.25em]{}
% for numeric bibliography
\newcommand{\tldatecventryV}[2][color1]{%
\issincefalse
\tl@formatstartyear{#2}
\cventryV{\tikz[baseline=0pt]{
\useasboundingbox (2ex,0ex) rectangle (\hintscolumnwidthV,1ex);
\fill [\tl@runningcolor] (0,0)
rectangle (\hintscolumnwidthV,\tl@runningwidth);
\fill [#1] (0,0)
++(\tl@startfraction*\hintscolumnwidthV,0pt)
node [tl@singleyear] {#2}
node {$\bullet$};
}}}
\makeatother
% 'numeric' bibliography environment (from numeric.bbx)
\defbibenvironment{bibliography}
{\list
{\printbibnumber % here you see the macro in action
\tldatecventryV{%
\thefield{year} % actual year from bibitem
}}
{\setlength{\topsep}{0pt}% layout parameters based on moderncvstyleclassic.sty
\setlength{\labelwidth}{\hintscolumnwidth}%
\setlength{\labelsep}{\separatorcolumnwidth}%
\setlength{\itemsep}{\bibitemsep}%
\leftmargin\labelwidth%
\addtolength{\leftmargin}{-.35\labelsep}% <-- changed
\advance\leftmargin\labelsep
}%
\sloppy\clubpenalty4000\widowpenalty4000}
{\endlist}
{\item}
%-----------------------
\AtEveryBibitem{\clearfield{year}}
%-------------------------------------------------------------------------------
% reverse numbering of publications
%-------------------------------------------------------------------------------
% Count total number of entries in each refsection
\AtDataInput{%
\csnumgdef{entrycount:\therefsection}{%
\csuse{entrycount:\therefsection}+1}}
% Print the labelnumber as the total number of entries in the
% current refsection, minus the actual labelnumber, plus one
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}
\newrobustcmd*{\mkbibdesc}[1]{%
\number\numexpr\csuse{entrycount:\therefsection}+1-#1\relax}
%------------------- Personal Data for CV header -------------------------------
\name{Joan}{Doe}
%-------------------------------------------------------------------------------
\begin{document}
\makecvtitle
\nocite{*}
\printbibliography[type=article,title={Journal Publications}]
\end{document}