25
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]{...
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
...
16
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 ...
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:...
14
votes
Accepted
Biblatex: how to automatically sort citation by year (sortcites=ynt) when references are sorted by name (sorting=nyt)
Update
With biblatex v3.18 and above you can use \localrefcontext and \GenRefcontextData to switch to a different reference context (e.g. sorting).
Use
\AtBeginRefsection{\GenRefcontextData{sorting=...
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, ...
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: ...
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}, ...
11
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 ...
11
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,xparse}
\ExplSyntaxOn
\prg_new_conditional:Nnn \...
11
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
\...
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(...
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} }
\...
10
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>
...
10
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 = {...
10
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&...
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}
\...
9
votes
Accepted
Grouping sorted bibliographyies by langid
Of course one can just put a \sort{\field{langid}} into the sorting procedure, but that will sort the languages lexicographically, so English will appear first, then Greek and then Russian, not ...
9
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 ...
9
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 ...
9
votes
Accepted
natbib does not sort&compress
natbib is not able to sort \citet cites, because it sorts and compresses only number sequences. It does not test, whether or not the names are same, before it compresses the number sequences. So only \...
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]{}
...
8
votes
Accepted
How to sort in biblatex by name, year, order of appearance
Look in the file biblatex.def to find definitions of the different sortings. Based on a combination of the sorting=none sorting and sorting=nyt I came up with the following which I call sorting=nyc (c ...
7
votes
Sort sections according to alphabetical order
The Idea
The solution uses one technique you did not prefer. Namely, putting sections in separate files. However, that is is only (non-cumbersome) I can find in order to sort the sections.
Anyway, ...
7
votes
Lexicographic ordering in expl3
Somthing similar can be achieved using LuaTeX. Sorting is probably much faster in Lua.
To parse the comma list I use utilities.parsers.settings_to_array from ConTeXt. To do so, I have to import the ...
7
votes
Order list of names with Lua
In ConTeXt you do not have to reinvent the wheel.
\def\sort#1{%
\ctxlua{
context(
table.concat(
table.sorted(
utilities.parsers.settings_to_array([[#1]]) ) , ", " ) )
}}
...
7
votes
Biblatex: how to automatically sort citation by year (sortcites=ynt) when references are sorted by name (sorting=nyt)
A 'quick and dirty' solution (less good than moewe's one) is use biblatex's sortcites=false option, to enable the manual sorting of in-line citations.
\documentclass{article}
\usepackage[%
...
7
votes
Accepted
Trying to eliminate stack overflow during recursion (Alphabetic Bubble Sorter)
something like this allows the parameter stack to be popped before the recursive call
\documentclass[10pt]{article}
\newcommand\alphabubblesort[1]{\def\sortedlist{}\expandafter\sortlist#1,zzzzzzzzzz,\...
7
votes
Accepted
Bibliography First Name Sorting
With Biber you can use
\documentclassarticle}
\usepackage[backend=biber, style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}
\DeclareSortingNamekeyScheme{
\keypart{
\namepart{...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sorting × 591biblatex × 190
bibliographies × 129
bibtex × 110
indexing × 59
natbib × 47
biber × 44
citing × 32
glossaries × 27
lists × 17
cross-referencing × 16
nomenclature × 16
tables × 13
macros × 12
acronyms × 12
apa-style × 12
xindy × 12
itemize × 11
subdividing × 11
imakeidx × 9
enumerate × 8
datatool × 8
makeindex × 8
table-of-contents × 7
floats × 7