1

I'm new to this whole latex thing and I'm having trouble understanding and defining the order in which my references appear after being compiled. I would like them to be sorted alphabetically based on the first entry in the "author" field; however, the order in which they are appearing in the PDF seems to be entirely random. What am I doing wrong?

Here's how a section of my .bib file is written as of right now:

@online{plano_diretor,
    author = "Belo Horizonte",
    title = " Lei nº 11.181, de 8 de agosto de 2019, aprova o Plano Diretor, em consonância com o disposto no Estatuto da Cidade",
    url  = "https://www.cmbh.mg.gov.br/atividade-legislativa/pesquisar-legislacao/lei/11181/2019",
    addendum = "(acesso em: 02/09/2023)",
    keywords = "plano_diretor,11.181"
}

@online{bh_map, author = "Prefeitura de Belo Horizonte", title = " BH Map - Mapa Oficial da Prefeitura de Belo Horizonte", url = "https://bhmap.pbh.gov.br/v2/mapa/idebhgeo#zoom=4&lat=7796893.0925&lon=609250.9075&baselayer=base", addendum = "(acesso em: 02/09/2023)", keywords = "BH_Map,bh map" }

@online{PMSBH, author = "Prefeitura de Belo Horizonte", title = "Plano Municipal de Saneamento de Belo Horizonte 2020/2023 (PMS 2020/2023).", url = "https://prefeitura.pbh.gov.br/sites/default/files/estrutura-de-governo/obras-e-infraestrutura/2021/_pms2020-2023_texto_completo.pdf", addendum = "(acesso em: 02/09/2023)", keywords = "pmsbh" }

@article{starling2015risco, title={O risco geol{'o}gico como justificativa para remo{\c{c}}{~o}es for{\c{c}}a-\das no Aglomerado Santa L{'u}cia e na Vila Bandeirantes em Belo Horizonte}, author={Starling, Paula Miller}, year={2015}, publisher={Universidade Federal de Minas Gerais} }

@article{PRAD_ICMbio, title={Roteiro de Apresentação para Plano de Recuperação de Área Degradada (PRAD) Terrestre}, author={Instituto Chico Mendes da Conservação da Biodiversidade - ICMbio}, year={2013}, publisher={Ministério do Meio Ambiente} }

@article{Unidades_Geotecnicas, title={Caracterização das unidades geotécnicas da porção leste da região metropolitana de Belo Horizonte–MG}, author={dos Reis Junior, Walter and Parizzi, Maria Giovana}, year={2018}, publisher={Geonomos} }

@article{areas_inundacao, title={Áreas de risco município de Belo Horizonte}, author={PRODABEL}, year={2022}, publisher={Prefeitura de Belo Horizonte} }

@article{NBR12216, title={NBR 12216: Projeto de estação de tratamento de água para abastecimento público}, author={Associação Brasileira de Normas Técnicas}, year={1992}, publisher={ABNT} }

@article{Abastecimento_agua, title={Abastecimento de Água para Consumo Humano}, author={Heller, Léo and de Pádua, Valter Lúcio}, year={2006}, publisher={Editora UFMG} }

here's how my main.tex file looks like:

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
%\usepackage[sorting=nyt]{biblatex}
\usepackage[
backend=biber,
style=numeric,
sorting=nyt
]{biblatex}
\addbibresource{biblio.bib}

\input{00_config} \onehalfspacing

\usepackage[nottoc]{tocbibind}

\belowcaptionskip=10pt

\newtoggle{beforesection} \preto\section{\toggletrue{beforesection}} \preto\subsection{\toggletrue{beforesection}} \preto\subsubsection{\toggletrue{beforesection}} \preto\table{\iftoggle{beforesection}{\togglefalse{beforesection}}{}}

\newtoggle{captionedtable} \preto\caption{\toggletrue{captionedtable}} \AtEndEnvironment{table}{\iftoggle{beforesection}{\iftoggle{captionedtable}{\togglefalse{captionedtable}}{\vspace{-30pt}}}{\iftoggle{captionedtable}{\togglefalse{captionedtable}}{\vspace{-15pt}}}}

\AtEndEnvironment{figure}{{\vspace{-10pt}}}

%começa cada seção em uma nova pagina %\let\oldsection\section %\renewcommand\section{\clearpage\oldsection}

\begin{document}

\input{titlepage}

\clearpage \newpage \input{folharosto}

\clearpage \newpage \tableofcontents

\clearpage \newpage \listoffigures \listoftables

\clearpage \newpage

\input{01_intro} \input{02_objetivos} \input{03_diag_area} %\input{04_sistema_de_transportes} \input{05_abastecimento_de_agua} \input{06_esgotamento_sanitário} \input{07_drenagem_de_águas_pluviais} \input{08_aterro_sanitario} \input{09_projeto_estrutural} %\input{10_Conclusão}

\clearpage \newpage \printbibliography[heading=bibintoc] \clearpage \newpage

\nocite{*}

\end{document}

and i will attach an image to show how my compiled file looks like

I wanted my references with authors whose names start with the letter "A" to appear first and so on.

I am definitely not a programmer and I am writing this document with five other colleagues, none of whom are programmers either, so I apologize for this messy code.

compiled file

cfr
  • 198,882
  • 1
    We don't have the files you are \inputting, so we cannot run your example or even be sure that we see all the code we need to see to diagnose the problem. From what I can tell from the code so far you are missing curly braces around "corporate" authors (https://tex.stackexchange.com/q/10808/35864): It needs to be author = "{Prefeitura de Belo Horizonte}",, not author = "Prefeitura de Belo Horizonte",, otherwise Biber tries to split the name into family and given name and sort it that way, which goes wrong for non-person names. ... – moewe Nov 09 '23 at 06:04
  • 1
    ... Your screenshot shows more weird things, though, that the .bib file you have shown does not explain. Some names are separated with e, some with &. This shouldn't happen and I can only presume this is because you used the wrong input format. The correct format is explained in https://tex.stackexchange.com/q/557/35864, https://tex.stackexchange.com/q/36396/35864. It looks like you're trying to manually imitate ABNT style, in which case you should probably just load https://www.ctan.org/pkg/biblatex-abnt instead. – moewe Nov 09 '23 at 06:07
  • Thank you, Moewe, for your time. I managed to resolve all my issues by combining your advice with Andrew Swann's. I added the missing curly braces, loaded biblatex-abnt and added a sortkey where needded, as you suggested, and it worked like a charm after a few tweaks in the body of my document. I really appreciate your help, guys! – Henrique Vieira Nov 09 '23 at 23:13

1 Answers1

1

The bibliography is sorted according to the rule you passed to biblatex, namely sorting=nyt: so first by name of the author (last name, then first names), then by year and finally by title. You should look at the biblatex documentation for a description of other possible sorting options. I would also recommend reading the section on the author field in the chapter 3 of the document "Tame the beast", which carefully describes the required format.

However, in your case you also have different types of authors: some are people others are institutions. As moewe said the institution names need to entered in the .bib file with extra enclosing braces

author = "{Prefeitura de Belo Horizonte}",

You can also optionally add a sortkey, for example if you wished the entry to be sorted as Belo Horizonte:

sortkey = {Belo Horizonte}

This gives

Sample output

for the input files, where I have specified the portuguese language option.

tex

\documentclass[a4paper,12pt]{article}

\usepackage[portuguese]{babel} \usepackage[utf8]{inputenc} \usepackage[ backend=biber, style=numeric, sorting=nyt ]{biblatex} \addbibresource{biblio.bib}

\begin{document}

\printbibliography[heading=bibintoc] \nocite{*}

\end{document}

biblio.bib

@Online{plano_diretor,
  author =   {{Belo Horizonte}},
  title =    {Lei nº 11.181, de 8 de agosto de 2019, aprova o
                  Plano Diretor, em consonância com o disposto no
                  Estatuto da Cidade},
  url =
                  {https://www.cmbh.mg.gov.br/atividade-legislativa/pesquisar-legislacao/lei/11181/2019},
  addendum =     {(acesso em: 02/09/2023)},
  keywords =     {plano_diretor,11.181}
}

@Online{bh_map, author = {{Prefeitura de Belo Horizonte}}, title = {BH Map - Mapa Oficial da Prefeitura de Belo Horizonte}, url = {https://bhmap.pbh.gov.br/v2/mapa/idebhgeo#zoom=4&lat=7796893.0925&lon=609250.9075&baselayer=base}, addendum = {(acesso em: 02/09/2023)}, sortkey = {Belo Horizonte}, keywords = {BH_Map,bh map} }

@Online{PMSBH, author = {{Prefeitura de Belo Horizonte}}, title = {Plano Municipal de Saneamento de Belo Horizonte 2020/2023 (PMS 2020/2023).}, url = {https://prefeitura.pbh.gov.br/sites/default/files/estrutura-de-governo/obras-e-infraestrutura/2021/_pms2020-2023_texto_completo.pdf}, addendum = {(acesso em: 02/09/2023)}, sortkey = {Belo Horizonte}, keywords = {pmsbh} }

@Article{starling2015risco, author = {Starling, Paula Miller}, title = {O risco geol{'o}gico como justificativa para remo{\c{c}}{~o}es for{\c{c}}adas no Aglomerado Santa L{'u}cia e na Vila Bandeirantes em Belo Horizonte}, year = 2015, publisher = {Universidade Federal de Minas Gerais} }

@Article{PRAD_ICMbio, author = {{Instituto Chico Mendes da Conservação da Biodiversidade - ICMbio}}, title = {Roteiro de Apresentação para Plano de Recuperação de Área Degradada (PRAD) Terrestre}, year = 2013, publisher = {Ministério do Meio Ambiente} }

@Article{Unidades_Geotecnicas, author = {dos Reis Junior, Walter and Parizzi, Maria Giovana}, title = {Caracterização das unidades geotécnicas da porção leste da região metropolitana de Belo Horizonte–MG}, year = 2018, publisher = {Geonomos} }

@Article{areas_inundacao, author = {{PRODABEL}}, title = {Áreas de risco município de Belo Horizonte}, year = 2022, publisher = {Prefeitura de Belo Horizonte} }

@Article{NBR12216, author = {{Associação Brasileira de Normas Técnicas}}, title = {NBR 12216: Projeto de estação de tratamento de água para abastecimento público}, year = 1992, publisher = {ABNT} }

@Article{Abastecimento_agua, author = {Heller, Léo and de Pádua, Valter Lúcio}, title = {Abastecimento de Água para Consumo Humano}, year = 2006, publisher = {Editora UFMG} }

Andrew Swann
  • 95,762