I have a file kuerzel.tex. What is the best way to sort them alphabetically by the value in the square brackets [] or the second value inside the {} (e.g. [EU] or Europäische Union)? This should happen best automatically when I also create the latex file. Say at the end I would like to have the following:
\acro{eugh}[EuGH]{Europäischer Gerichtshof}
\acro{eu}[EU]{Europäische Union}
\acro{gr}[GR]{Griechenland}
main.tex
\documentclass{report}
\usepackage[ngerman]{babel}
\usepackage[demo]{graphicx}
\usepackage[nohyperlinks, printonlyused]{acronym}
\usepackage{hyperref}
\usepackage[ngerman]{cleveref}
\usepackage[parfill]{parskip}
\begin{document}
\begin{acronym}[EuGH]
\input{kuerzel}
\end{acronym}
Der \ac{eugh} ist das oberste rechtsprechende Organ der
\ac{eu}. Die \ac{eu} ist dabei ein Staatenverbund aus 27 europäischen Ländern. Und \ac{gr} hat eine sehr gute Landwirtschaft, welcher stark gefördert werden sollte.
\end{document}
kuerzel.tex
\acro{gr}[GR]{Griechenland}
\acro{eu}[EU]{Europäische Union}
\acro{eugh}[EuGH]{Europäischer Gerichtshof}
You can use the
glossariespackage instead: