4

I'm writing my thesis using Latex. And I'm wondering if there is an automatic or an easy way to write my acronyms. I did that before in Microsoft Word where I search for all words that are upper case then add them to my acronyms and sort them alphabetically?

9
  • 2
    @Rmano I don't see how this is a similar question. – Tak May 4 '15 at 11:42
  • 2
    @Rmano: That's a completely different problem. The OP is after automation, not for the basic usage of acronyms – user31729 May 4 '15 at 12:24
  • You could use grep to search for all uppercase characters and generate the TeX commands. – Uwe Ziegenhagen May 4 '15 at 13:21
  • Just to add to the question: and sort them alphabetically – latex fan May 4 '15 at 14:04
  • @latexfan Done :) – Tak May 4 '15 at 14:05
3

enter image description here

\documentclass{article}
\usepackage{luacode}

\begin{luacode}
function FindAcronyms ( file )
    local param
    local Table = {}

    local f = assert(io.open(file, "r"))
    local t = f:read("*all")
    f:close()
    for param in t:gmatch ("[^%l]%s?(%u+)%p?%s")
    do
    table.insert(Table, param)
    end

    table.sort(Table)
    tex.print("\\bigskip")
    for i,acronym in ipairs (Table)
        do
        tex.print (i.." : "..acronym.."\\\\")
        end
end

\end{luacode}

\newcommand{\FindAcronyms}{%
    \directlua{FindAcronyms("\jobname.tex")}
}


\begin{document}

CCC! SomeThing ELSe AAA, CABA enD BAA 


\FindAcronyms


\end{document}
1
  • 1
    Are you looking for \jobname.tex? – egreg Aug 3 '15 at 10:49
0

Not sure I understand what you are after, but may be package acronym will be of interest to you. It expands acronyms on first use and allows you to compile a list of them all.

1
  • I know this. But this is not what I'm looking for in my question. – Tak May 4 '15 at 13:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.