GithubHelp home page GithubHelp logo

Comments (12)

jkitchin avatar jkitchin commented on July 17, 2024

You should probably provide more detail on how you are exporting. If you are using C-c e l L then citet:&merker-2022-machin-learn should export to \citet{merker-2022-machin-learn}. If LaTeX is your goal, this is the preferred way to export.

If you use C-c e r l instead then you will get a full citeprocitem via CSL. There is not a one to one mapping with CSL to the LaTeX cite commands, or feature parity with this option.

from org-ref.

wardfont avatar wardfont commented on July 17, 2024

I am specifically exporting to pdf with C-c e r p. Is there a way to configure org-ref to the desired behaviour?

from org-ref.

jkitchin avatar jkitchin commented on July 17, 2024

C-c C-e l o should work out of the box to get a pdf via LaTeX.

from org-ref.

wardfont avatar wardfont commented on July 17, 2024

C-c C-e l o gives me undefined citations, as the bibliography file reference is not properly exported to latex (bibliography:bibliography.bib in the org file gets exported to /bibliography{bibliography} in the tex file).

How would I go modifying the behaviour of citeprocitem to properly show year when using citet:?

from org-ref.

jkitchin avatar jkitchin commented on July 17, 2024

I assume you mean \bibliography{bibliography}. That is probably correct. if you have undefined citations, it could mean you are missing some entries that are in another file, or there is some issue with the entries in the bib file. you should share a small example that shows the problem.

from org-ref.

wardfont avatar wardfont commented on July 17, 2024

Using the following in my org file:

#+title: Cite

[[citet:&zimmermannClimaticExtremesImprove2009]]

  • References

bibliographystyle:chicago
bibliography:bibliography.bib

I get the following .tex output when exporting using C-c e r p:

% Created 2022-11-30 Wed 16:37
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\makeatletter
\newcommand{\citeprocitem}[2]{\hyper@linkstart{cite}{citeproc_bib_item_#1}#2\hyper@linkend}
\makeatother
\author{Ward Fonteyn}
\date{\today}
\title{Cite}
\hypersetup{
pdfauthor={Ward Fonteyn},
pdftitle={Cite},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 28.1 (Org mode 9.6)},
pdflang={English}}
\begin{document}

\maketitle
\tableofcontents

Zimmermann et al. \citeprocitem{1}{Zimmermann et al. 2009}

\section{References}
\label{sec:org72b5651}

\bibliographystyle{chicago}

\hypertarget{citeproc_bib_item_1}{Zimmermann, Niklaus E., Nigel G. Yoccoz, Thomas C. Edwards, Eliane S. Meier, Wilfried Thuiller, Antoine Guisan, Dirk R. Schmatz, and Peter B. Pearman. 2009. โ€œClimatic Extremes Improve Predictions of Spatial Patterns of Tree Species.โ€ \textit{Proceedings of the National Academy of Sciences} 106 (supplement\_2). Proceedings of the National Academy of Sciences: 19723โ€“28. doi:\href{https://doi.org/10.1073/pnas.0901643106}{10.1073/pnas.0901643106}.}
\end{document}

and get this in my pdf:

image

instead of the expected "Zimmermann et al. (2009)"

from org-ref.

jkitchin avatar jkitchin commented on July 17, 2024

can you share the bib file? or at least the entry in question? It does not make sense to go through CSL for export to PDF via Latex. It is certainly better to let latex do the work.

from org-ref.

wardfont avatar wardfont commented on July 17, 2024

This is the bib file contents:

@Article{zimmermannClimaticExtremesImprove2009,
title = {Climatic Extremes Improve Predictions of Spatial Patterns of Tree Species},
author = {Zimmermann, Niklaus E. and Yoccoz, Nigel G. and Edwards, Thomas C. and Meier, Eliane S. and Thuiller, Wilfried and Guisan, Antoine and Schmatz, Dirk R. and Pearman, Peter B.},
year = {2009},
month = nov,
journal = {Proceedings of the National Academy of Sciences},
volume = {106},
number = {supplement_2},
pages = {19723--19728},
publisher = {{Proceedings of the National Academy of Sciences}},
doi = {10.1073/pnas.0901643106},
file = {/home/wardfont/bibliography/bibtex-pdfs/zimmermannClimaticExtremesImprove2009.pdf}
}

@Article is not capitalised in the file, but here is formatted that way.

I appreciate your time helping me.

from org-ref.

jkitchin avatar jkitchin commented on July 17, 2024

Maybe the problem is citet is not a native cite command in latex, and you have to use the natbib package to get it defined.
You need to add the natbib package like this:

Then for this:

with (setq org-latex-pdf-process (list "latexmk -shell-escape -bibtex -f -pdf %f"))

#+title: Cite
#+latex_header: \usepackage{natbib}
#+options: toc:nil

See [[citet:&zimmermannClimaticExtremesImprove2009]] 

bibliographystyle:chicago
bibliography:bibliography.bib 

image

from org-ref.

wardfont avatar wardfont commented on July 17, 2024

Adding the natbib package does fix the export using "C-c e l o". The same issue is still present when using "C-c e l r" however.

I will be using the former option from now on. Thank you for your time and this wonderful package!

from org-ref.

wardfont avatar wardfont commented on July 17, 2024

The same issue is also present when exporting to html, odt or word format using "C-c e r"

from org-ref.

jkitchin avatar jkitchin commented on July 17, 2024

The issue is there are two exporters: latex and CSL, and they do not support all options of each other. Latex is the best imo for org-ref, as I wrote it to provide near complete support of latex for citation rendering.

CSL is a different approach to citation rendering, and it does not use the latex citation commands. That means you can only ever get close to what latex does, and somethings are not even possible right now when using csl. Adding natbib has no effect on CSL export because it does not use any of the latex capabilities, you have to rely on an incomplete mapping of CSL to the latex cite commands.

anyway, the short version is for latex, use the latex exporter commands and you will get what you want. For everything else, use the org-ref CSL exporter, but stick to simpler cite commands.

from org-ref.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.