Skip to content

Better glossary entry insert #3

Description

@nico202

Hi! Thanks for this, I'm writing my PhD thesis right now with a (slightly) modified version of this!

One thing I did not like were the acronym and glossaryentry macros (being macros you have to escape commas (,), and they are a bit difficult to read, and there's no easy way to export them to html.

I wrote the following, maybe it can help somebody else:

* Acronym and Glossary                                             :noexport:

#+name: acronyms
| abbrev | long                   |
|--------+------------------------|
| VE     | Virtual Environment    |
| VR     | Virtual Reality        |
| OSC    | Open Sound Control     |
| UDP/IP | User Datagram Protocol |

#+name: glossary
| ref          | name                   | description                                  | sort                  |
|--------------+------------------------+----------------------------------------------+-----------------------|
| FFD          | Force--Feedback Device | Mechanical devices able to produce forces... | Force-Feedback Device |

* Exporting Acronym and Glossary                                     :ignore:
# Definitions
# glossary: ref, name, description, sort

** Description                                                    :noexport:
The following functions are used to convert the tables (ref:acronyms and
ref:glossary) to latex headers.

** Code                                                             :ignore:
#+name: acronym-from-table
#+begin_src emacs-lisp :var tbl=acronyms :results output drawer :exports results
  (defun acronym-header (l)
    (princ (format "#+latex_header: \\newacronym{%s}{%s}{%s}\n"
                   (nth 0 l) (nth 0 l) (nth 1 l))))
  (mapcar 'acronym-header tbl)
#+end_src

#+begin_src emacs-lisp :var tbl=glossary :results output drawer :exports results
  (defun glossary-header (l)
    (princ (format "#+latex_header: \\newglossaryentry{%s}{name={%s},description={%s},sort={%s}}\n"
                   (nth 0 l) (nth 1 l) (nth 2 l) (nth 3 l))))
   (mapcar 'glossary-header tbl)
#+end_src

Basically are just 2 tables with 2 simple blocks that convert them to the #+latex_header: entry.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions