我希望您能帮助我获取参考书目的自定义标签。
我想获取参考书目标签的特定格式,\biblatex
仅使用 ; 两个字符,按字母顺序排列:
- 作者姓名的第一个字符。
- 一个数字,这是第一个字符的列表。
我知道我必须改变\DeclareLabelalphaTemplate
;但我不知道如何改变,我正在使用这个代码:
\documentclass[11pt,a4paper]{article}
\usepackage[spanish, es-noshorthands]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=alphabetic,backend=biber]{biblatex}
\usepackage{hyperref}
\addbibresource{bib.bib}
\DeclareLabelalphaTemplate{
\labelelement{
\field[final]{shorthand}
\field{label}
\field[strwidth=1,strside=left,ifnames=1,compound=false]{labelname}
}
\labelelement{ %I have to change or add here, I suppose.
\field[]{}
}
}
\begin{document}
These are my references, \cite{bael}, \cite{is}, \cite{macgregor}, \cite{morales}, \cite{nationalacademy-joints}, \cite{pfeiffer}.
\printbibliography
\end{document}
这是我的书目数据:
@book{morales,
author = {R. Morales},
title = {Diseño Estructural Sismorresistente},
publisher = {Fondo Editorial ICG},
year = {2002},
address = {Lima},
pages = {4-5},
}
@book{macgregor,
author = {J. MacGregor and J. Wight},
title = {Reinforced Concrete Mechanics and Design},
publisher = {Prentice Hall},
date = {2011},
location = {Upper Saddle River, New Jersey},
pages = {71-71},
}
@report{pfeiffer,
author = {Michael J. Pfeiffer, and David Darwin},
title = {Joint Design for Reinforced Concrete Buildings},
institution = {University of Kansas Structural Engineering and Materials Laboratory},
date = {1987},
location = {Lawrence, KS},
pages = {73},
}
@book{seae,
author = {Departamento de Tecnología Industrial},
title = {Código Técnico de la Edificación. Documento Básico SE-AE Seguridad Estructural: Acciones en la Edificación},
location = {Madrid},
date = {2007},
pages = {9},
}
@book{bael,
title = {Règles de techniques de conception et de calcul des ouvrages et construction en béton armé suivant la méthode des états limites},
author = {Ministère de l'Equipement des Transports et du Logement},
location = {Paris},
date = {1999},
pages = {86-87},
}
@book{is,
title = {Plain and Reinforced Concrete - Code of Practice IS 456-2000},
edition = {Fourth},
author = {Bureau of Indian Standards},
location = {Nueva Delhi},
date = {2000},
pages = {86-87},
}
@report{pca-joints,
title = {Buildings Movements and Joints},
author = {Portland Cement Association},
location = {Skokie, Illinois},
date = {1983},
pages = {36},
}
@report{nationalacademy-joints,
title = {Expansion Joints in Buildings},
author = {Standing Commitee on Structural Engineering of the Federal Construction Council},
number = {Technical Report No. 65},
institution = {National Academy of Sciences},
location = {Washington},
date = {1974},
pagetotal = {43},
}
@book{vallecilla,
author = {C. Ramiro Vallecilla},
title = {Fuerzas Sísmicas Principios y Aplicaciones NSR-98},
publisher = {Editorial Bauen},
location = {Bogotá},
date = {2003},
pages = {192-201},
}
@online{senhami,
author = {Servicion Nacional de Meteorología e Hidrología},
organization = {Ministerio del Ambiente},
title = {Datos Históricos},
url = {http://www.senamhi.gob.pe/main_mapa.php?t=dHi},
}
这张图片描绘了我想要的,
答案1
我真的希望有人能想出比这更干净的解决方案,但我们就开始吧。
基于奥黛丽对“如何按字母顺序划分参考书目?”的回答以及我的回答使用循环定义 bibchecks充分利用奥黛丽的回答,我建议如下。
我们将使用该numeric
样式及其prefixnumbers
选项来实现此解决方案(后者需要defernumbers
启用)。
首先,我们为字母表中的每个字母创建一个参考书目类别,以确保跳过的条目不会造成麻烦
\makeatletter
\def\ifskipbib{\iftoggle{blx@skipbib}}
\makeatother
\def\initlist{}
\forcsvlist{\listadd\initlist}{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}
\forlistloop{\DeclareBibliographyCategory}{\initlist}
\AtDataInput{\ifskipbib{}{\addtocategory{\thefield{sortinit}}{\thefield{entrykey}}}}
然后,在文档中,我们循环遍历所有类别并打印它们:每个类别都有自己的参考书目,并通过prefixnumbers
相关字母作为前缀(当然,我们也希望有一个标题)
\printbibheading
\foreach \letter in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}{%
\begingroup\edef\myprintbib{\endgroup\printbibliography[category=\letter,prefixnumbers=\letter,heading=none]}\myprintbib
}
这个稍微奇怪的\edef
定义是由于扩展(否则我无法正确理解,所以非常欢迎更好的想法)。
平均能量损失
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[spanish, es-noshorthands]{babel}
\usepackage{filecontents}
\usepackage{csquotes}
\usepackage{pgffor}
\usepackage[backend=biber,style=numeric,backend=biber,defernumbers]{biblatex}
\usepackage{hyperref}
\begin{filecontents*}{\jobname.bib}
@book{morales,
author = {R. Morales},
title = {Diseño Estructural Sismorresistente},
publisher = {Fondo Editorial ICG},
year = {2002},
address = {Lima},
pages = {4-5},
}
@book{macgregor,
author = {J. MacGregor and J. Wight},
title = {Reinforced Concrete Mechanics and Design},
publisher = {Prentice Hall},
date = {2011},
location = {Upper Saddle River, New Jersey},
pages = {71-71},
}
@report{pfeiffer,
author = {Michael J. Pfeiffer and David Darwin},
title = {Joint Design for Reinforced Concrete Buildings},
institution = {University of Kansas Structural Engineering and Materials Laboratory},
date = {1987},
location = {Lawrence, KS},
pages = {73},
}
@book{seae,
author = {{Departamento de Tecnología Industrial}},
title = {Código Técnico de la Edificación. Documento Básico SE-AE Seguridad Estructural: Acciones en la Edificación},
location = {Madrid},
date = {2007},
pages = {9},
}
@book{bael,
title = {Règles de techniques de conception et de calcul des ouvrages et construction en béton armé suivant la méthode des états limites},
author = {{Ministère de l'Equipement des Transports et du Logement}},
location = {Paris},
date = {1999},
pages = {86-87},
}
@book{is,
title = {Plain and Reinforced Concrete - Code of Practice IS 456-2000},
edition = {Fourth},
author = {Bureau of Indian Standards},
location = {Nueva Delhi},
date = {2000},
pages = {86-87},
}
@report{pca-joints,
title = {Buildings Movements and Joints},
author = {{Portland Cement Association}},
location = {Skokie, Illinois},
date = {1983},
pages = {36},
}
@report{nationalacademy-joints,
title = {Expansion Joints in Buildings},
author = {{Standing Commitee on Structural Engineering of the Federal Construction Council}},
number = {Technical Report No. 65},
institution = {National Academy of Sciences},
location = {Washington},
date = {1974},
pagetotal = {43},
}
@book{vallecilla,
author = {C. Ramiro Vallecilla},
title = {Fuerzas Sísmicas Principios y Aplicaciones NSR-98},
publisher = {Editorial Bauen},
location = {Bogotá},
date = {2003},
pages = {192-201},
}
@online{senhami,
author = {{Servicion Nacional de Meteorología e Hidrología}},
organization = {Ministerio del Ambiente},
title = {Datos Históricos},
url = {http://www.senamhi.gob.pe/main_mapa.php?t=dHi},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\makeatletter
\def\ifskipbib{\iftoggle{blx@skipbib}}
\makeatother
\def\initlist{}
\forcsvlist{\listadd\initlist}{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}
\forlistloop{\DeclareBibliographyCategory}{\initlist}
\AtDataInput{\ifskipbib{}{\addtocategory{\thefield{sortinit}}{\thefield{entrykey}}}}
\begin{document}
These are my references, \cite{bael}, \cite{is}, \cite{macgregor}, \cite{morales}, \cite{nationalacademy-joints}, \cite{pfeiffer}.
\printbibheading
\foreach \letter in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}{%
\begingroup\edef\myprintbib{\endgroup\printbibliography[category=\letter,prefixnumbers=\letter,heading=none]}\myprintbib
}
\end{document}