Hot answers tagged

22 votes
Accepted

How can I sort a list numerically?

This approach automatically orders the items by year or any other number, by using an external list on an .csv file. \documentclass{article} \usepackage{filecontents} % To create an external .csv file ...
user avatar
  • 3,945
21 votes
Accepted

Sort bibliography in order of appearance

You cannot mix BibTeX and biblatex. In your code remove \bibliographystyle{unsrt} (which is BibTeX language) and load biblatex with sorting=none \usepackage[backend=biber,style=numeric,sorting=none]{...
user avatar
  • 159k
15 votes
Accepted

Biblatex handling of Dutch "van" prefix

With a current biblatex version I recommend the slightly longer, but conceptually cleaner solution presented in Prefixes in author names in references and bibliography. The answer here still remains ...
user avatar
  • 159k
15 votes
Accepted

Sort Numbers After Their Values

Easy with xparse and expl3: \documentclass{article} \usepackage{xparse,expl3} \ExplSyntaxOn \NewDocumentCommand{\sortnumberlist}{m} { \clist_set:Nn \l_svend_numberlist_clist { #1 } \clist_sort:...
user avatar
  • 993k
15 votes

Sorting a comma-separated list with LaTeX?

How about Lua? \def\sortlist#1{% \directlua{% local t = { #1 } table.sort(t) tex.sprint(table.concat(t,", ")) }% } \sortlist{"World", "Hello"} \bye Addendum: One of the really ...
user avatar
14 votes

LaTeX/BibTex not arranging citations by order of appearance

In Document»Settings»Bibliography choose the Default (numerical) bibliography style. And then go to Latex preamble section and write this code: \bibliographystyle{unsrtnat} \usepackage[numbers,sort&...
user avatar
14 votes
Accepted

Biblatex: how to automatically sort citation by year (sortcites=ynt) when references are sorted by name (sorting=nyt)

Give the desired citation sort order at loading time. Then give the desired order for the bibliography in the new refcontext (\begin{refcontext}[sorting=<sorting>]...\end{refcontext}) for \...
user avatar
  • 159k
13 votes
Accepted

Sorting a comma-separated list with LaTeX?

This seems to work, with no packages. EDITED to solve the upper/lower-case problem. EDIT: Resolved problem when a comparison ran out of letters prior to resolving the order, for example, wash, ...
user avatar
12 votes
Accepted

Lexicographic ordering in expl3

At present there are no built-in methods for such textual comparisons (there are generic sorting wrappers but one has to supply the comparison code). The reason for this is that sorting is complex: ...
user avatar
  • 243k
12 votes

How can I sort a list numerically?

You could make use of the glossaries package as shown in the following example: \documentclass{article} \usepackage[automake, nonumberlist]{glossaries} \newglossaryentry{1912}{name={1912}, ...
user avatar
  • 60.6k
11 votes
Accepted

biblatex: cite without affecting sorting order

Here's a solution, and although it requires some manual intervention it is much less hacky than your external script solution. Furthermore, as I show at the end, we can automate it quite easily. The ...
user avatar
  • 202k
11 votes
Accepted

The same bibliography with different sorting

What about using \newrefcontext before each \printbibliography (apart the first which is under the context of the default sorting option of biblatex). \documentclass{article} \usepackage[utf8]{...
user avatar
  • 29.4k
11 votes
Accepted

Regex replacement for biblatex/biber to eliminate the warning "month not integer..."

\DeclareSourcemap{ \maps[datatype=bibtex]{ \map[overwrite]{ \step[fieldsource=month, match=\regexp{\A(j|J)an(uary)?\Z}, replace=1] \step[fieldsource=month, match=\regexp{\A(f|F)eb(...
user avatar
  • 159k
10 votes

Cleveref isn't sorting nested lists properly

Turns out @Karalga's explanation of the cause of this bug points in the right direction, but doesn't get to the bottom of the problem. Sorting of nested list labels was broken for two completely ...
user avatar
  • 1,982
10 votes

Expandable (quick) sort array macro?

A short demo using l3sort: \documentclass{article} \usepackage{expl3,l3sort,xparse} \ExplSyntaxOn \cs_set:Npn \quicksort_fp:nnTF #1#2 { \fp_compare:nNnTF {#2} > {#1} } \...
user avatar
  • 243k
10 votes

Sorting a comma-separated list with LaTeX?

You can safely compare strings consisting of ASCII characters; words with accented characters will not work. \documentclass{article} \usepackage{expl3,l3sort,xparse} \ExplSyntaxOn \...
user avatar
  • 993k
10 votes
Accepted

Order table by row alphabeticaly

A proof of concept, using an idea from https://tex.stackexchange.com/a/356777/4427 \documentclass{article} \usepackage{geometry} \usepackage{longtable} \usepackage{xparse} \ExplSyntaxOn \...
user avatar
  • 993k
10 votes

How can I sort a list numerically?

If you prefer the solution to be as close to your syntax as possible: \documentclass{article} \usepackage{expl3} \usepackage{xparse} \usepackage{enumitem} \usepackage{xcolor} \begin{document} \...
user avatar
  • 4,685
9 votes

How to sort entries in a .bib file with biber

For anyone using a more recent version of biber, the element names have changed slightly. As of biber 2.11, sorting is now sortingtemplate name="tool". This config file works for me: <config> ...
user avatar
  • 101
9 votes
Accepted

Using Bibtool to sort a bib file by types and keys alphabetically

Following the example on page 60 of the BibTool manual, the type can be specified with %s($type). Example: @misc{def, note = {misc entry 1} } @article{xyz, author = {John Doe}, title = {...
user avatar
  • 29.8k
8 votes
Accepted

How to sort entries in a .bib file with biber

Actually with biber 2.3, which is what you are using, it should work with a suitable <sorting> specification in your biber.conf. There was a bug in 2.4, fixed in the 2.5 dev version currently on ...
user avatar
  • 21.4k
8 votes
Accepted

Put Chinese-language entries before English-language entries in the bibliography

You could use the \noopsort device to place the Chinese-language entries ahead of the remaining entries. The macro \noopsort takes 1 argument and is defined as follows: \newcommand{\noopsort}[1]{} ...
user avatar
  • 439k
8 votes

Using Bibtool to sort a bib file by types and keys alphabetically

If you are using Biber you can use the following sort.conf <?xml version="1.0" encoding="UTF-8"?> <config> <output_align>true</output_align> <output_fieldcase>lower&...
user avatar
  • 159k
7 votes

Sort thebibliography by citation order

I'd already created 150 references in a document using thebibliography, and was faced with the task of sorting them in order of first appearance in the text (a very common requirement in scientific ...
user avatar
  • 93
7 votes

Index in Swedish sorting order ( ...YZÅÄÖ...) with xindy and LaTeX

In his answer michal.h21 has identified the problem and found the problem in the way, UTF-8 characters are written, if \usepackage[utf8]{inputenc} is used: \IeC{<LICR>}% LICR = LaTeX Internal ...
user avatar
7 votes

How to change a .bst for references sorted in order of appearance

The zip file has only splncs03.bst which uses alphabetical order. However, Springer also provides splncs.bst that uses order of appearance. You can download it at ftp://ftp.springer.de/pub/tex/latex/...
user avatar
  • 993k
7 votes
Accepted

Order by first author only (not all names) than by year or Sort by a partial entry in biblatex

How I commented in your question I see two possibilities for sorting the bibliographies entries: The first: Using only the Last Name of the First Author How you are using biber, you are able to use ...
user avatar
7 votes
Accepted

Cleveref isn't sorting nested lists properly

Usually, counters in latex reference their parent counter when being initialised: \newcounter{NameOfTheNewCounter}[NameOfTheOtherCounter]. This way, the \label command can access all the parents in ...
user avatar
  • 1,152
7 votes
Accepted

wrong sorting in index (ligatures) \/

makeindex can only sort alphabetic entries, so if you need to add markup to the typeset form (\/ here) then you need to supply a separate sort key, so the entries need to be something like: \index{...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible