I am using Overleaf as an editor and came across their dictionary template. When I write my own entries they don't get sorted by alphabetical order as a dictionary should be.

Q: How could one sort \entry{}s by alphabetical order of the aforementioned dictionary template?


\documentclass[10pt,a4paper,twoside]{article} % 10pt font size, A4 paper and two-sided margins
\usepackage[top=3.5cm,bottom=3.5cm,left=3.7cm,right=4.7cm,columnsep=30pt]{geometry} % Document margins and spacings
\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters
\usepackage{palatino} % Use the Palatino font
\usepackage{microtype} % Improves spacing
\usepackage{multicol} % Required for splitting text into multiple columns
\usepackage[bf,sf,center]{titlesec} % Required for modifying section titles - bold, sans-serif, centered
\usepackage{fancyhdr} % Required for modifying headers and footers
\fancyhead[L]{\textsf{\rightmark}} % Top left header
\fancyhead[R]{\textsf{\leftmark}} % Top right header
\renewcommand{\headrulewidth}{1.4pt} % Rule under the header
\fancyfoot[C]{\textbf{\textsf{\thepage}}} % Bottom center footer
\renewcommand{\footrulewidth}{1.4pt} % Rule under the footer
\pagestyle{fancy} % Use the custom headers and footers throughout the document

\newcommand{\entry}[4]{\markboth{#1}{#1}\textbf{#1}\ {(#2)}\ \textit{#3}\ $\bullet$\ {#4}}  % Defines the command to print each word on the page, \markboth{}{} prints the first word on the page in the top left header and the last word in the top right


%   Section A



\entry{Aardvark}{ahrd-vahrk}{Noun}{A nocturnal badger-sized burrowing mammal of Africa, with long ears, a tubular snout, and a long extensible tongue, feeding on ants and termites. Also called antbear.}

% . . . 

\entry{Azobenzene}{az-oh-ben-zeen}{Noun}{A synthetic crystalline organic compound used chiefly in dye manufacture.}


%  Section B



\entry{Babble}{bab-uh l}{Verb}{Talk rapidly and continuously in a foolish, excited, or incomprehensible way.}

% ......

\entry{Bystander}{bahy-stan-der}{Noun}{A person who is present at an event or incident but does not take part.}


  • Don't link to external resources. Add a small complete example here. – Ulrike Fischer Aug 7 '19 at 9:13
  • @UlrikeFischer implemented MWE – 3kstc Aug 7 '19 at 10:35
  • Nothing in this template is setup for automatic sorting, you will have to input the entries in the correct order. If you want something more automatic check the glossaries package. – Ulrike Fischer Aug 7 '19 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.