Closed fiatisdead closed 2 years ago
You need to build it like this:
#+BEGIN_SRC emacs-lisp
(let ((org-export-before-parsing-hook '(org-ref-glossary-before-parsing org-ref-acronyms-before-parsing)))
(org-open-file (org-latex-export-to-pdf)))
#+END_SRC
also, First ac:bb. Second ac:bb. First ac:qos. Second ac:qos. are not acronym links anymore:
(defvar org-ref-acronym-types
'(("acrshort" "The acronym for label")
("acrshortpl" "The acronym for label in plural")
("Acrshort" "Capitalized acronym")
("Acrshortpl" "Plural capitalized acronym")
("ACRshort" "ALL-CAPS acronym")
("ACRshortpl" "ALL-CAPS plural acronym")
("acrlong" "The label definition")
("acrlongpl" "The plural definition")
("Acrlong" "Capitalized definition")
("Acrlongpl" "Plural capitalized definition")
("ACRlong" "ALL-CAPS definition")
("ACRlongpl" "plural ALL-CAPS definition")
("acrfull" "Both the acronym and its definition")
("acrfullpl" "Both the acronym and its definition in plural")
("Acrfull" "Capitalized both the acronym and its definition")
("Acrfullpl" "Capitalized both the acronym and its definition in plural")
("ACRfull" "Both the acronym and its definition in ALL-CAPS")
("ACRfullpl" "Both the acronym and its definition in plurall ALL-CAPS"))
"list of acronym types (type description)")
I guess you could make them links if you add them to that list though.
Thanks John for your reply. Its really appreciated. My knowledge of emacs is pretty limited tbh and so this is somewhat confusing for me. In Emacs 26.3 and Org-Mode 9.1.14 this used to just work out of the box. I'm assuming from the above things are no longer so simple?
ie. I could just add two org tables in my org file, one named glossary and one named acronym towards the end of the document and then I would simply add to the document the following properties prior to exporting to pdf.
and add \printglossaries before \printbibliography and it just worked on export (C-c C-e l o)
(When I say worked it produced a Glossary Page with the entries from the table and a list of acronyms under the heading Acronyms. I am wondering if there was some kind of parsing hook in my original init.el file but having checked through previous configs I cannot for the life of me figure out what is going on or indeed why this no longer works as it did.
I tried to evaluate that the above source code and whilst it did not export the tables this time it did not produce a Glossary or any list of Acronyms on the test file.
I attempt to show you the full example as below.
#+latex_header: \usepackage{glossaries}
#+latex_header: \makeglossaries
# #+LATEX_HEADER: \usepackage[colorlinks=true,breaklinks]{hyperref}
Acronym entries: [[gls:lvm][LVM]] and another one [[gls:lvm][LVM]] and one more ac:tla
gls:son
A [[gls:computer][computer]] is good for computing. Gls:computer is capitalized. We can also use a bunch of glspl:computer to make a cluster. Glspl:computer a re the wave of the future. They do not use up any glspl:tree.
(or-next-glossary-link nil)
[[gls:tree][tree]] fjdsa;fdsa
Labels and refs: label:one
label:two ref:two
Multiply defined label:one
#+BEGIN_SRC emacs-lisp
(let ((org-export-before-parsing-hook '(org-ref-glossary-before-parsing org-ref-acronyms-before-parsing)))
(org-open-file (org-latex-export-to-pdf)))
#+END_SRC
#+RESULTS:
bibliography:test-1.bib
#+name: acronyms
| label | abbreviation | full form |
|-------+--------------+----------------------|
| tla | TLA | three letter acronym |
| qos | QoS | Quality-of-Service |
#+name: glossary
| label | term | definition |
|----------+----------+------------------------|
| test | test | a test |
| son | son | male |
| naive | naive | lacking sophisticatio |
| tree | tree | a big, woody plant |
| computer | computer | a digital machine |
| lvm | LVM | logical volume manager |
[[printglossaries:]]
When I evaluate the source block you provided I get the following result: test-2.pdf
You will see that it is pulling through the glossary and acronyms. I have realised your point above ac: no longer works i need to use acrshort: or acrfull: - understood. But the Output Glossary Index and Output Acronym Index at the back of the document are still missing. I'm unsure how to remedy this.
I make a further explanatory comment to state that I have removed the default hyperref from org-latex-default-packages-alist
'(org-latex-default-packages-alist
'(("AUTO" "inputenc" t
("pdflatex"))
("T1" "fontenc" t
("pdflatex"))
("" "graphicx" t nil)
("" "longtable" nil nil)
("" "wrapfig" nil nil)
("" "rotating" nil nil)
("normalem" "ulem" t nil)
("" "amsmath" t nil)
("" "amssymb" t nil)
("" "capt-of" nil nil)
)))
and I have commented out the adding back in of the hyperef package as you will not need that (but I do) for testing the example, This is mandatory for me to do on every org file as the early call of hyperref as default causes conflicts with the way I use Oscola-Biblatex packages which is the primary reason I use emacs.
I attach an example pdf of what the output used to look like when I exported using C-c C-e l o example.pdf
Having rechecked my init.org / init.el files - I cannot see any pre-parse hooks that I used to call. Put simply all I did was put the two org tables in the org file and run the standard org-export to pdf using the default keybinding C-c C-e l o
This gave me the output in example.pdf above.
I guess you are not running this correctly.
Put a section like this at the end:
* build :noexport:
#+BEGIN_SRC emacs-lisp
(let ((org-export-before-parsing-hook '(org-ref-glossary-before-parsing org-ref-acronyms-before-parsing)))
(org-open-file (org-latex-export-to-pdf)))
#+END_SRC
Then execute that emacs-lisp block with C-c C-c
If you want C-c C-e lo to work like before, you need to add this to your init file:
(setq org-export-before-parsing-hook '(org-ref-glossary-before-parsing org-ref-acronyms-before-parsing))
This is different in version 3 than it was in version 2.
Again, I really appreciate your help here. I appreciate that as you will see from the below that this appears not to be an issue with org-ref as demonstrated below. Any pointers I would be very grateful.
Put a section like this at the end:
* build :noexport:
(let ((org-export-before-parsing-hook '(org-ref-glossary-before-parsing org-ref-acronyms-before-parsing))) (org-open-file (org-latex-export-to-pdf)))
> Then execute that emacs-lisp block with C-c C-c
It brings through the acronyms and the glossary terms into the PDF but still is not printing the glossary or index.
Org-file:
[test-2.org.zip](https://github.com/jkitchin/org-ref/files/9097187/test-2.org.zip)
Tex-file:(compiled from running the above)
[test-2.tex.zip](https://github.com/jkitchin/org-ref/files/9097190/test-2.tex.zip)
pdf:
[test-2.pdf](https://github.com/jkitchin/org-ref/files/9097192/test-2.pdf)
I am really at a loss as to what is going on. I have tried stripping down almost all of my config and even tried to use your sandbox from the github using your init files from github source and still no joy.
The issue I think is with Latex or pdflatex as I think the .tex looks right as it is correctly parsing the acronym and glossary entries into the tex file and has /printglossaries before /printbibliography which should work right?
I wonder if you would mind testing the .tex file and see if you run pdflatex are you seeing the glossary and acronym printed before the bibliogrpahy or just the same three page pdf?
This I guess will prove the issue to be outside of org-ref I think but I haven't the first clue as to what is going on here. Something that worked previously so simple is literally now driving me crazy. :)
Thank you in advance with this,
The above files are compressed as .zip because github does not permit .org or .tex files to be uploaded.
Ok, I've figured out a work-around. I never had to do this previously as I said C-c C-e l o just worked out the box.
It now makes and prints the glossary.
Unsure why this is now necessary as it never used to be on previous versions. Any way to remove this manual intervention and have orgmode export to pdf without the requirement of the manual work-around would be super helpful. I'd happily donate to a charity of your choosing or your work.
(this response was in preparation when I saw your additional comment above).
It could be related to building the pdf. Somewhere you need to get makeglossaries
to run. I do this by using ox-manuscript-latex-pdf-process
which is what org-latex-pdf-process
is set to.
or, see https://github.com/jkitchin/org-ref/blob/master/org-ref.org#latex-export and adapt it like this:
(setq org-latex-pdf-process
'("pdflatex -interaction nonstopmode -output-directory %o %f"
"bibtex %b"
"makeglossaries %b"
"pdflatex -interaction nonstopmode -output-directory %o %f"
"pdflatex -interaction nonstopmode -output-directory %o %f"))
I think that should do it.
It seems tricky to get latexmk to do this correctly, but it is probably also possible.
Thank you again for your help. Much appreciated. Sadly changing from my latexmk in the init to the suggestion above breaks my citations. I get a list of citekeys as footnotes instead of the properly formatted citations being rendered.
I will stick with the manual work-around as I have to manually process makeglossaries to do the table of contents and index of legal cases and statutes so this is no hardship for the final pdf and the links are working in the org-file so its no big deal.
Happy to donate to your work so send me a link. Thanks again and huge respect for all you do. Peace. Once done you can close this.
You should probably change bibtex to biber then. The list of commands should match what you do at the command line.
You should probably change bibtex to biber then. The list of commands should match what you do at the command line.
Wow, Thank you.
(setq org-latex-pdf-process
'("pdflatex -interaction nonstopmode -output-directory %o %f"
"biber %b"
"makeglossaries %b"
"pdflatex -interaction nonstopmode -output-directory %o %f"
"pdflatex -interaction nonstopmode -output-directory %o %f"
"splitindex %b -s oscola"
"pdflatex -interaction nonstopmode -output-directory %o %f"))
This works better than ever and now means I no longer have to manually post-process TOC index front matter of cases/statutes. C-c C-e l o and we are done.
:) I will sort github sponsor in a few days. Thanks.
Summary Solution
Original Issue of Glossary and Acronym Tables not being removed at export was resolved by adding the below to init.el
(setq org-export-before-parsing-hook '(org-ref-glossary-before-parsing org-ref-acronyms-before-parsing))
This then morphed into a second issue where the \PrintGlossaries were not automatically making and rendering in the pdf output. Having reviewed the LaTeX document I could see the issue was not with org-ref but the pdf build process.
For total clarity I have never previously needed to have a "makeglossaries %b" in the emacs init.el file. In order for \printglossaries to output into the pdf - Now it appears necessary.
Thank you to @jkitchin for all the help here.
To fix the pdf build issue and print the glossaries we changed the org-latex-pdf-process in my init.el to
(setq org-latex-pdf-process
'("pdflatex -interaction nonstopmode -output-directory %o %f"
"biber %b"
"makeglossaries %b"
"pdflatex -interaction nonstopmode -output-directory %o %f"
"pdflatex -interaction nonstopmode -output-directory %o %f"
"splitindex %b -s oscola"
"pdflatex -interaction nonstopmode -output-directory %o %f"))
Thanks for the summary solution!
OS: Windows 10 Emacs Version: 28.1 (Org-Version) 9.5.4
Steps to Reproduce:
I fully expect this to be a user error as I have recently had to start over my setup on Windows10. I'm probably missing something.
This is the Output test-1.pdf
I had previously tried with a MWE org file to test glossary and acronym which failed with:
I then decided to download your current github repo and try the sandbox
I attach the MWE below incase it is useful.