reddit / emacs

How can I export references with apa style using org-mode?

lord4ris · 2022-05-21 20:34
I'm trying to make documents with apa7 style, and almost everything is going well so far, but I'm struggling to get proper apa citations. I already read a lot of information about that, but I don't know what am I missing. I'll show you my template and the way I'm trying to do the citations: :PROPERTIES: :ID: 93dd321a-735c-4640-9418-b9cab79e86a2 :END: #+title: latex #+AUTHOR: My name \ Matrícula: 12345 #+LATEX_HEADER: \affiliation{My university} #+LATEX_HEADER: \course{environmental management} #+LATEX_HEADER: \professor{Docente: my teacher's name} #+LATEX_HEADER: \duedate{20-may-2022} #+LATEX_CLASS: apa7 #+LANGUAGE: es #+LATEX_CLASS_OPTIONS: [a4paper, 12, stu, floatsintext] #+LATEX_HEADER: \usepackage{amsmath} #+LATEX_HEADER: \usepackage{graphicx} #+LATEX_HEADER: \usepackage[utf8]{inputenc} #+LATEX_HEADER: \usepackage[spanish]{babel} #+LATEX_HEADER: \usepackage{booktabs} #+LATEX_HEADER: \usepackage{multirow} #+LATEX_HEADER: \usepackage{longtable} #+LATEX_HEADER: \usepackage{array} #+LATEX_HEADER: \usepackage{float} #+LATEX_HEADER: \shorttitle{} #+LATEX_HEADER: \usepackage{csquotes} #+LATEX_HEADER: \usepackage{placeins} #+LATEX_HEADER: \usepackage[backend=biber, style=apa]{biblatex} #+LATEX_HEADER: \addbibresource{referencias.bib} #+LATEX_HEADER: \usepackage{tabularx} #+LATEX_HEADER: \usepackage{longtable}[=v4.13] #+LATEX_HEADER: \usepackage{booktabs} #+LATEX_HEADER: \usepackage{array} #+bibliography:/references.bib #+cite_export: biblatex apa [citep:arellanodiazSaludTrabajoSeguridad2013a] * Título #+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB} [[~/testimage.jpg]] #+LATEX_HEADER: \printbibliography{} So far, I'm getting almost everything I need, except for proper citations and a bibliography section. Citations are formatted with squared brackets, and I can't get the bibliography section (which should be apa7 style). ​ Edit: Thank you so much for your help!! The solution was easier than I thought. I got it by reading the [Org-ref Manual](https://github.com/jkitchin/org-ref/blob/master/org-ref.org) Basically I did this: `M-x org-ref-insert-link`(to get the reference) add `[[printbibliography:]]`to the end of my document, and that was it. It seems that my document was almost fully prepared to get the apa citation style. I don't even modified my init.el file.
mclearc · 2022-05-21 22:47
I'm assuming you're on a recent version of org-mode that allows native citation. Make sure you have org-cite set up properly: ```emacs-lisp (use-package oc :after org :config (setq org-cite-global-bibliography `(,lem-bibliography)) (setq org-cite-export-processors '((beamer csl) (latex csl) (t csl)))) ;; Currently only using csl (use-package oc-csl :after oc :init ;; make sure to download csl ;; https://citationstyles.org ;; https://github.com/citation-style-language ;; repos for styles & locales (setq org-cite-csl-styles-dir "~/path/to/csl/styles") (setq org-cite-csl-locales-dir "~/path/to/csl/locales")) ``` Make sure apa7 is part of the csl styles dir that you're setting. Then you just need this in your org document or referenced by that document: ```emacs-lisp #+cite_export: csl apa7.csl #+bibliography: ~/path/to/bibfile.bib ``` Finally make sure you have the following line where ever you want the reference section to go: ```emacs-lisp #+print_bibliography: ```