* Problem with references to babel source blocks (possible bug).
@ 2018-12-17 15:32 Emmanuel Charpentier
0 siblings, 0 replies; 7+ messages in thread
From: Emmanuel Charpentier @ 2018-12-17 15:32 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1994 bytes --]
I wish to be able to reference (i. e cross-references, lists) both some
tables or figures AND the code producing the objects.
To this effect, I added (distinct) #+caption:s to the source blocks AND
to the results, adorned with (distinct) org-ref's labels. An example is
included in the enclosed file Min-Ref.org.
The comparison of this source, the LaTeX code obtained by org-latex
export-to latex (Min-Ref.tex) and the resultant PDF (Min-Ref exported
by org-latex-export-to-pdf.pdf) show that the labels attributed to
source blocks are mislabeled as figures. Furthermore, while the org
source requests a list of figure, a list of table and a list of
listings (in that order), the list of figures appears *after* the list
of tables.
I am tempted to conclude that there is some confusion between figures
and listings. Further attempts tend to show that the problem may live n
the core org's code, rather than any specific exporter :
The ODT "native" exporter (org-odt-export-to-odt) is much less capable,
as shown in Min-Ref exported by org-odt-export-to-odt.odt.
Attempts to export via Pandoc to PDF (Min-Ref exported by org-pandoc-
export-to-latex-pdf.pdf), ODT (Min-Ref exported by org-pandoc-export-
to-odt.odt) and DOCX (Min-Ref.docx) show that these exporters may need
some specific configurations in order to be even vaguely usable.
Previous trials, using #+names: rather than org-ref's labels, gave
similar failures. If needed, I can reproduce these trials.
So I have a couple questions :
1) Is the confusion of source blocks and figures a bug, or do I miss a
subtle point ?
2) Is there some introductory material to the care and feeding of ox-
pandoc demonstrating the use of this exporter's options to enable the
addition of the needed features (figure inclusion, tables of tables /
figures / listings, etc...) ? The "manual" available as a README i way
too terse to be usable without diving in the source code and pandoc's
documentation.
Sincerely,
--
Emmanuel Charpentier
[-- Attachment #2: Min-Ref.docx --]
[-- Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document, Size: 10789 bytes --]
[-- Attachment #3: Min-Ref.org --]
[-- Type: text/plain, Size: 1645 bytes --]
#+options: toc:nil
#+property: header-args:python :session
#+language: fr
#+title: What's up with references ?
#+author:
#+date: December 2018
#+toc: headlines
#+toc: figures
#+toc: tables
#+toc: listings
* Some reference samples
This is created using =org-ref= 's =label= 's and =ref= 's.
** A reference...
... to cite:gelmanBayesianDataAnalysis2013 ,a /good/ textbook.
** A table
A Python block producing a (silly) table.
#+caption: A (silly) Python block. label:lst:Python1
#+BEGIN_SRC python :results table :exports both
[[u+str(v) for v in range(1,4)] for u in ["a", "b"]]
#+END_SRC
#+caption: A (silly) Python table. label:tab:Python1
#+RESULTS:
| a1 | a2 | a3 |
| b1 | b2 | b3 |
The table ref:tab:Python1 is produced by the code ref:lst:Python1.
** A figure
A Python block producing a figure.
#+caption: A Python block producing a figure. label:lst:Python2
#+BEGIN_SRC python :results file :exports both
import matplotlib.pyplot as plt, numpy as np
from sympy import *
x=symbols("x")
f=lambda x:sin(x)/x
t=np.arange(-6*np.pi,6*np.pi, 0.1)
ft=[f(u) for u in t]
fig=plt.figure(figsize=(3,2))
plt.plot(t, ft, "b-")
fig.tight_layout()
plt.savefig("tstfig.pdf")
"tstfig.pdf"
#+END_SRC
#+caption: A (not so silly) figure produced by Python. label:fig:Python2
#+RESULTS:
[[file:tstfig.pdf]]
The figure ref:fig:Python2 is produced by the code ref:lst:Python2.
[[bibliographystyle:vancouver]]
[[bibliography:Minimal.bib]]
# Local Variables:
# org-latex-packages-alist: (("AUTO" "babel" t ("pdflatex")) ("AUTO" "polyglossia" t ("xelatex" "lualatex")))
# org-latex-pdf-process: ("latexmk -shell-escape -bibtex -f -pdf %f")
# End:
[-- Attachment #4: Min-Ref.tex --]
[-- Type: text/x-tex, Size: 2236 bytes --]
% Created 2018-12-17 lun. 15:49
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage[frenchb]{babel}
\date{December 2018}
\title{What's up with references ?}
\hypersetup{
pdfauthor={},
pdftitle={What's up with references ?},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 27.0.50 (Org mode 9.1.14)},
pdflang={Frenchb}}
\begin{document}
\maketitle
\tableofcontents
\listoftables
\listoffigures
\section{Some reference samples}
\label{sec:orgfe4b8ad}
This is created using \texttt{org-ref} 's \texttt{label} 's and \texttt{ref} 's.
\subsection{A reference\ldots{}}
\label{sec:org22891f6}
\ldots{} to \cite{gelmanBayesianDataAnalysis2013} ,a \emph{good} textbook.
\subsection{A table}
\label{sec:org844d514}
A Python block producing a (silly) table.
\begin{verbatim}
[[u+str(v) for v in range(1,4)] for u in ["a", "b"]]
\end{verbatim}
\captionof{figure}{A (silly) Python block. \label{lst:Python1}}
\begin{table}[htbp]
\caption{A (silly) Python table. \label{tab:Python1}}
\centering
\begin{tabular}{lll}
a1 & a2 & a3\\
b1 & b2 & b3\\
\end{tabular}
\end{table}
The table \ref{tab:Python1} is produced by the code \ref{lst:Python1}.
\subsection{A figure}
\label{sec:orgf75a27d}
A Python block producing a figure.
\begin{verbatim}
import matplotlib.pyplot as plt, numpy as np
from sympy import *
x=symbols("x")
f=lambda x:sin(x)/x
t=np.arange(-6*np.pi,6*np.pi, 0.1)
ft=[f(u) for u in t]
fig=plt.figure(figsize=(3,2))
plt.plot(t, ft, "b-")
fig.tight_layout()
plt.savefig("tstfig.pdf")
"tstfig.pdf"
\end{verbatim}
\captionof{figure}{A Python block producing a figure. \label{lst:Python2}}
\begin{figure}[htbp]
\centering
\includegraphics[width=.9\linewidth]{tstfig.pdf}
\caption{A (not so silly) figure produced by Python. \label{fig:Python2}}
\end{figure}
The figure \ref{fig:Python2} is produced by the code \ref{lst:Python2}.
\bibliographystyle{vancouver}
\bibliography{Minimal}
\end{document}
[-- Attachment #5: Min-Ref exported by org-latex-export-to-pdf.pdf --]
[-- Type: application/pdf, Size: 143423 bytes --]
[-- Attachment #6: Min-Ref exported by org-odt-export-to-odt.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 18946 bytes --]
[-- Attachment #7: Min-Ref exported by org-pandoc-export-to-latex-pdf.pdf --]
[-- Type: application/pdf, Size: 202284 bytes --]
[-- Attachment #8: Min-Ref exported by org-pandoc-export-to-odt.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 17044 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Problem with references to babel source blocks (possible bug).
[not found] <1669578320.377567952.1545064721537.JavaMail.root@zimbra43-e7.priv.proxad.net>
@ 2018-12-17 16:40 ` emm.charpentier
2018-12-18 17:00 ` Emmanuel Charpentier
1 sibling, 0 replies; 7+ messages in thread
From: emm.charpentier @ 2018-12-17 16:40 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1994 bytes --]
I wish to be able to reference (i. e cross-references, lists) both some
tables or figures AND the code producing the objects.
To this effect, I added (distinct) #+caption:s to the source blocks AND
to the results, adorned with (distinct) org-ref's labels. An example is
included in the enclosed file Min-Ref.org.
The comparison of this source, the LaTeX code obtained by org-latex
export-to latex (Min-Ref.tex) and the resultant PDF (Min-Ref exported
by org-latex-export-to-pdf.pdf) show that the labels attributed to
source blocks are mislabeled as figures. Furthermore, while the org
source requests a list of figure, a list of table and a list of
listings (in that order), the list of figures appears *after* the list
of tables.
I am tempted to conclude that there is some confusion between figures
and listings. Further attempts tend to show that the problem may live n
the core org's code, rather than any specific exporter :
The ODT "native" exporter (org-odt-export-to-odt) is much less capable,
as shown in Min-Ref exported by org-odt-export-to-odt.odt.
Attempts to export via Pandoc to PDF (Min-Ref exported by org-pandoc-
export-to-latex-pdf.pdf), ODT (Min-Ref exported by org-pandoc-export-
to-odt.odt) and DOCX (Min-Ref.docx) show that these exporters may need
some specific configurations in order to be even vaguely usable.
Previous trials, using #+names: rather than org-ref's labels, gave
similar failures. If needed, I can reproduce these trials.
So I have a couple questions :
1) Is the confusion of source blocks and figures a bug, or do I miss a
subtle point ?
2) Is there some introductory material to the care and feeding of ox-
pandoc demonstrating the use of this exporter's options to enable the
addition of the needed features (figure inclusion, tables of tables /
figures / listings, etc...) ? The "manual" available as a README is way
too terse to be usable without diving in the source code and pandoc's
documentation.
Sincerely,
--
Emmanuel Charpentier
[-- Attachment #2: Min-Ref.docx --]
[-- Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document, Size: 10789 bytes --]
[-- Attachment #3: Min-Ref.org --]
[-- Type: application/octet-stream, Size: 1645 bytes --]
#+options: toc:nil
#+property: header-args:python :session
#+language: fr
#+title: What's up with references ?
#+author:
#+date: December 2018
#+toc: headlines
#+toc: figures
#+toc: tables
#+toc: listings
* Some reference samples
This is created using =org-ref= 's =label= 's and =ref= 's.
** A reference...
... to cite:gelmanBayesianDataAnalysis2013 ,a /good/ textbook.
** A table
A Python block producing a (silly) table.
#+caption: A (silly) Python block. label:lst:Python1
#+BEGIN_SRC python :results table :exports both
[[u+str(v) for v in range(1,4)] for u in ["a", "b"]]
#+END_SRC
#+caption: A (silly) Python table. label:tab:Python1
#+RESULTS:
| a1 | a2 | a3 |
| b1 | b2 | b3 |
The table ref:tab:Python1 is produced by the code ref:lst:Python1.
** A figure
A Python block producing a figure.
#+caption: A Python block producing a figure. label:lst:Python2
#+BEGIN_SRC python :results file :exports both
import matplotlib.pyplot as plt, numpy as np
from sympy import *
x=symbols("x")
f=lambda x:sin(x)/x
t=np.arange(-6*np.pi,6*np.pi, 0.1)
ft=[f(u) for u in t]
fig=plt.figure(figsize=(3,2))
plt.plot(t, ft, "b-")
fig.tight_layout()
plt.savefig("tstfig.pdf")
"tstfig.pdf"
#+END_SRC
#+caption: A (not so silly) figure produced by Python. label:fig:Python2
#+RESULTS:
[[file:tstfig.pdf]]
The figure ref:fig:Python2 is produced by the code ref:lst:Python2.
[[bibliographystyle:vancouver]]
[[bibliography:Minimal.bib]]
# Local Variables:
# org-latex-packages-alist: (("AUTO" "babel" t ("pdflatex")) ("AUTO" "polyglossia" t ("xelatex" "lualatex")))
# org-latex-pdf-process: ("latexmk -shell-escape -bibtex -f -pdf %f")
# End:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: Min-Ref.tex --]
[-- Type: text/x-tex; name=Min-Ref.tex, Size: 2236 bytes --]
% Created 2018-12-17 lun. 15:49
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage[frenchb]{babel}
\date{December 2018}
\title{What's up with references ?}
\hypersetup{
pdfauthor={},
pdftitle={What's up with references ?},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 27.0.50 (Org mode 9.1.14)},
pdflang={Frenchb}}
\begin{document}
\maketitle
\tableofcontents
\listoftables
\listoffigures
\section{Some reference samples}
\label{sec:orgfe4b8ad}
This is created using \texttt{org-ref} 's \texttt{label} 's and \texttt{ref} 's.
\subsection{A reference\ldots{}}
\label{sec:org22891f6}
\ldots{} to \cite{gelmanBayesianDataAnalysis2013} ,a \emph{good} textbook.
\subsection{A table}
\label{sec:org844d514}
A Python block producing a (silly) table.
\begin{verbatim}
[[u+str(v) for v in range(1,4)] for u in ["a", "b"]]
\end{verbatim}
\captionof{figure}{A (silly) Python block. \label{lst:Python1}}
\begin{table}[htbp]
\caption{A (silly) Python table. \label{tab:Python1}}
\centering
\begin{tabular}{lll}
a1 & a2 & a3\\
b1 & b2 & b3\\
\end{tabular}
\end{table}
The table \ref{tab:Python1} is produced by the code \ref{lst:Python1}.
\subsection{A figure}
\label{sec:orgf75a27d}
A Python block producing a figure.
\begin{verbatim}
import matplotlib.pyplot as plt, numpy as np
from sympy import *
x=symbols("x")
f=lambda x:sin(x)/x
t=np.arange(-6*np.pi,6*np.pi, 0.1)
ft=[f(u) for u in t]
fig=plt.figure(figsize=(3,2))
plt.plot(t, ft, "b-")
fig.tight_layout()
plt.savefig("tstfig.pdf")
"tstfig.pdf"
\end{verbatim}
\captionof{figure}{A Python block producing a figure. \label{lst:Python2}}
\begin{figure}[htbp]
\centering
\includegraphics[width=.9\linewidth]{tstfig.pdf}
\caption{A (not so silly) figure produced by Python. \label{fig:Python2}}
\end{figure}
The figure \ref{fig:Python2} is produced by the code \ref{lst:Python2}.
\bibliographystyle{vancouver}
\bibliography{Minimal}
\end{document}
[-- Attachment #5: Min-Ref exported by org-latex-export-to-pdf.pdf --]
[-- Type: application/pdf, Size: 143423 bytes --]
[-- Attachment #6: Min-Ref exported by org-odt-export-to-odt.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 18946 bytes --]
[-- Attachment #7: Min-Ref exported by org-pandoc-export-to-latex-pdf.pdf --]
[-- Type: application/pdf, Size: 202284 bytes --]
[-- Attachment #8: Min-Ref exported by org-pandoc-export-to-odt.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 17044 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Problem with references to babel source blocks (possible bug).
[not found] <1669578320.377567952.1545064721537.JavaMail.root@zimbra43-e7.priv.proxad.net>
2018-12-17 16:40 ` Problem with references to babel source blocks (possible bug) emm.charpentier
@ 2018-12-18 17:00 ` Emmanuel Charpentier
1 sibling, 0 replies; 7+ messages in thread
From: Emmanuel Charpentier @ 2018-12-18 17:00 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Nicolas Goaziou
[-- Attachment #1: Type: text/plain, Size: 2136 bytes --]
[ Third attempt to send this mail to the emacs-orgmode list, > 24 hours
after second attempt. Nicolas, could you forward it if necessary ? ]
I wish to be able to reference (i. e cross-references, lists) both some
tables or figures AND the code producing the objects.
To this effect, I added (distinct) #+caption:s to the source blocks AND
to the results, adorned with (distinct) org-ref's labels. An example is
included in the enclosed file Min-Ref.org.
The comparison of this source, the LaTeX code obtained by org-latex
export-to latex (Min-Ref.tex) and the resultant PDF (Min-Ref exported
by org-latex-export-to-pdf.pdf) show that the labels attributed to
source blocks are mislabeled as figures. Furthermore, while the org
source requests a list of figure, a list of table and a list of
listings (in that order), the list of figures appears *after* the list
of tables.
I am tempted to conclude that there is some confusion between figures
and listings. Further attempts tend to show that the problem may live n
the core org's code, rather than any specific exporter :
The ODT "native" exporter (org-odt-export-to-odt) is much less capable,
as shown in Min-Ref exported by org-odt-export-to-odt.odt.
Attempts to export via Pandoc to PDF (Min-Ref exported by org-pandoc-
export-to-latex-pdf.pdf), ODT (Min-Ref exported by org-pandoc-export-
to-odt.odt) and DOCX (Min-Ref.docx) show that these exporters may need
some specific configurations in order to be even vaguely usable.
Previous trials, using #+names: rather than org-ref's labels, gave
similar failures. If needed, I can reproduce these trials.
So I have a couple questions :
1) Is the confusion of source blocks and figures a bug, or do I miss a
subtle point ?
2) Is there some introductory material to the care and feeding of ox-
pandoc demonstrating the use of this exporter's options to enable the
addition of the needed features (figure inclusion, tables of tables /
figures / listings, etc...) ? The "manual" available as a README is way
too terse to be usable without diving in the source code and pandoc's
documentation.
Sincerely,
--
Emmanuel Charpentier
[-- Attachment #2: Min-Ref.docx --]
[-- Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document, Size: 10789 bytes --]
[-- Attachment #3: Min-Ref.org --]
[-- Type: application/octet-stream, Size: 1645 bytes --]
#+options: toc:nil
#+property: header-args:python :session
#+language: fr
#+title: What's up with references ?
#+author:
#+date: December 2018
#+toc: headlines
#+toc: figures
#+toc: tables
#+toc: listings
* Some reference samples
This is created using =org-ref= 's =label= 's and =ref= 's.
** A reference...
... to cite:gelmanBayesianDataAnalysis2013 ,a /good/ textbook.
** A table
A Python block producing a (silly) table.
#+caption: A (silly) Python block. label:lst:Python1
#+BEGIN_SRC python :results table :exports both
[[u+str(v) for v in range(1,4)] for u in ["a", "b"]]
#+END_SRC
#+caption: A (silly) Python table. label:tab:Python1
#+RESULTS:
| a1 | a2 | a3 |
| b1 | b2 | b3 |
The table ref:tab:Python1 is produced by the code ref:lst:Python1.
** A figure
A Python block producing a figure.
#+caption: A Python block producing a figure. label:lst:Python2
#+BEGIN_SRC python :results file :exports both
import matplotlib.pyplot as plt, numpy as np
from sympy import *
x=symbols("x")
f=lambda x:sin(x)/x
t=np.arange(-6*np.pi,6*np.pi, 0.1)
ft=[f(u) for u in t]
fig=plt.figure(figsize=(3,2))
plt.plot(t, ft, "b-")
fig.tight_layout()
plt.savefig("tstfig.pdf")
"tstfig.pdf"
#+END_SRC
#+caption: A (not so silly) figure produced by Python. label:fig:Python2
#+RESULTS:
[[file:tstfig.pdf]]
The figure ref:fig:Python2 is produced by the code ref:lst:Python2.
[[bibliographystyle:vancouver]]
[[bibliography:Minimal.bib]]
# Local Variables:
# org-latex-packages-alist: (("AUTO" "babel" t ("pdflatex")) ("AUTO" "polyglossia" t ("xelatex" "lualatex")))
# org-latex-pdf-process: ("latexmk -shell-escape -bibtex -f -pdf %f")
# End:
[-- Attachment #4: Min-Ref.tex --]
[-- Type: text/x-tex, Size: 2236 bytes --]
% Created 2018-12-17 lun. 15:49
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage[frenchb]{babel}
\date{December 2018}
\title{What's up with references ?}
\hypersetup{
pdfauthor={},
pdftitle={What's up with references ?},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 27.0.50 (Org mode 9.1.14)},
pdflang={Frenchb}}
\begin{document}
\maketitle
\tableofcontents
\listoftables
\listoffigures
\section{Some reference samples}
\label{sec:orgfe4b8ad}
This is created using \texttt{org-ref} 's \texttt{label} 's and \texttt{ref} 's.
\subsection{A reference\ldots{}}
\label{sec:org22891f6}
\ldots{} to \cite{gelmanBayesianDataAnalysis2013} ,a \emph{good} textbook.
\subsection{A table}
\label{sec:org844d514}
A Python block producing a (silly) table.
\begin{verbatim}
[[u+str(v) for v in range(1,4)] for u in ["a", "b"]]
\end{verbatim}
\captionof{figure}{A (silly) Python block. \label{lst:Python1}}
\begin{table}[htbp]
\caption{A (silly) Python table. \label{tab:Python1}}
\centering
\begin{tabular}{lll}
a1 & a2 & a3\\
b1 & b2 & b3\\
\end{tabular}
\end{table}
The table \ref{tab:Python1} is produced by the code \ref{lst:Python1}.
\subsection{A figure}
\label{sec:orgf75a27d}
A Python block producing a figure.
\begin{verbatim}
import matplotlib.pyplot as plt, numpy as np
from sympy import *
x=symbols("x")
f=lambda x:sin(x)/x
t=np.arange(-6*np.pi,6*np.pi, 0.1)
ft=[f(u) for u in t]
fig=plt.figure(figsize=(3,2))
plt.plot(t, ft, "b-")
fig.tight_layout()
plt.savefig("tstfig.pdf")
"tstfig.pdf"
\end{verbatim}
\captionof{figure}{A Python block producing a figure. \label{lst:Python2}}
\begin{figure}[htbp]
\centering
\includegraphics[width=.9\linewidth]{tstfig.pdf}
\caption{A (not so silly) figure produced by Python. \label{fig:Python2}}
\end{figure}
The figure \ref{fig:Python2} is produced by the code \ref{lst:Python2}.
\bibliographystyle{vancouver}
\bibliography{Minimal}
\end{document}
[-- Attachment #5: Min-Ref exported by org-latex-export-to-pdf.pdf --]
[-- Type: application/pdf, Size: 143423 bytes --]
[-- Attachment #6: Min-Ref exported by org-odt-export-to-odt.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 18946 bytes --]
[-- Attachment #7: Min-Ref exported by org-pandoc-export-to-latex-pdf.pdf --]
[-- Type: application/pdf, Size: 202284 bytes --]
[-- Attachment #8: Min-Ref exported by org-pandoc-export-to-odt.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 17044 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Problem with references to babel source blocks (possible bug).
@ 2018-12-19 16:05 Emmanuel Charpentier
0 siblings, 0 replies; 7+ messages in thread
From: Emmanuel Charpentier @ 2018-12-19 16:05 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 2094 bytes --]
[ Sixth '!) attempt to send this question to emacs-orgmode. Sorry for the
possible duplicates... ]
I wish to be able to reference (i. e cross-references, lists) both some
tables or figures AND the code producing the objects.
To this effect, I added (distinct) #+caption:s to the source blocks AND
to the results, adorned with (distinct) org-ref's labels. An example is
included in the enclosed file Min-Ref.org.
The comparison of this source, the LaTeX code obtained by org-latex
export-to latex (Min-Ref.tex) and the resultant PDF (Min-Ref exported
by org-latex-export-to-pdf.pdf) show that the labels attributed to
source blocks are mislabeled as figures. Furthermore, while the org
source requests a list of figure, a list of table and a list of
listings (in that order), the list of figures appears *after* the list
of tables.
I am tempted to conclude that there is some confusion between figures
and listings. Further attempts tend to show that the problem may live n
the core org's code, rather than any specific exporter :
The ODT "native" exporter (org-odt-export-to-odt) is much less capable,
as shown in Min-Ref exported by org-odt-export-to-odt.odt.
Attempts to export via Pandoc to PDF (Min-Ref exported by org-pandoc-
export-to-latex-pdf.pdf), ODT (Min-Ref exported by org-pandoc-export-
to-odt.odt) and DOCX (Min-Ref.docx) show that these exporters may need
some specific configurations in order to be even vaguely usable.
Previous trials, using #+names: rather than org-ref's labels, gave
similar failures. If needed, I can reproduce these trials.
So I have a couple questions :
1) Is the confusion of source blocks and figures a bug, or do I miss a
subtle point ?
2) Is there some introductory material to the care and feeding of ox-
pandoc demonstrating the use of this exporter's options to enable the
addition of the needed features (figure inclusion, tables of tables /
figures / listings, etc...) ? The "manual" available as a README is way
too terse to be usable without diving in the source code and pandoc's
documentation.
Sincerely,
--
Emmanuel Charpentier
[-- Attachment #1.2: Type: text/html, Size: 8637 bytes --]
[-- Attachment #2: Min-Ref.org --]
[-- Type: application/octet-stream, Size: 1645 bytes --]
#+options: toc:nil
#+property: header-args:python :session
#+language: fr
#+title: What's up with references ?
#+author:
#+date: December 2018
#+toc: headlines
#+toc: figures
#+toc: tables
#+toc: listings
* Some reference samples
This is created using =org-ref= 's =label= 's and =ref= 's.
** A reference...
... to cite:gelmanBayesianDataAnalysis2013 ,a /good/ textbook.
** A table
A Python block producing a (silly) table.
#+caption: A (silly) Python block. label:lst:Python1
#+BEGIN_SRC python :results table :exports both
[[u+str(v) for v in range(1,4)] for u in ["a", "b"]]
#+END_SRC
#+caption: A (silly) Python table. label:tab:Python1
#+RESULTS:
| a1 | a2 | a3 |
| b1 | b2 | b3 |
The table ref:tab:Python1 is produced by the code ref:lst:Python1.
** A figure
A Python block producing a figure.
#+caption: A Python block producing a figure. label:lst:Python2
#+BEGIN_SRC python :results file :exports both
import matplotlib.pyplot as plt, numpy as np
from sympy import *
x=symbols("x")
f=lambda x:sin(x)/x
t=np.arange(-6*np.pi,6*np.pi, 0.1)
ft=[f(u) for u in t]
fig=plt.figure(figsize=(3,2))
plt.plot(t, ft, "b-")
fig.tight_layout()
plt.savefig("tstfig.pdf")
"tstfig.pdf"
#+END_SRC
#+caption: A (not so silly) figure produced by Python. label:fig:Python2
#+RESULTS:
[[file:tstfig.pdf]]
The figure ref:fig:Python2 is produced by the code ref:lst:Python2.
[[bibliographystyle:vancouver]]
[[bibliography:Minimal.bib]]
# Local Variables:
# org-latex-packages-alist: (("AUTO" "babel" t ("pdflatex")) ("AUTO" "polyglossia" t ("xelatex" "lualatex")))
# org-latex-pdf-process: ("latexmk -shell-escape -bibtex -f -pdf %f")
# End:
[-- Attachment #3: Min-Ref.docx --]
[-- Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document, Size: 10789 bytes --]
[-- Attachment #4: Min-Ref.tex --]
[-- Type: text/x-tex, Size: 2236 bytes --]
% Created 2018-12-17 lun. 15:49
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage[frenchb]{babel}
\date{December 2018}
\title{What's up with references ?}
\hypersetup{
pdfauthor={},
pdftitle={What's up with references ?},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 27.0.50 (Org mode 9.1.14)},
pdflang={Frenchb}}
\begin{document}
\maketitle
\tableofcontents
\listoftables
\listoffigures
\section{Some reference samples}
\label{sec:orgfe4b8ad}
This is created using \texttt{org-ref} 's \texttt{label} 's and \texttt{ref} 's.
\subsection{A reference\ldots{}}
\label{sec:org22891f6}
\ldots{} to \cite{gelmanBayesianDataAnalysis2013} ,a \emph{good} textbook.
\subsection{A table}
\label{sec:org844d514}
A Python block producing a (silly) table.
\begin{verbatim}
[[u+str(v) for v in range(1,4)] for u in ["a", "b"]]
\end{verbatim}
\captionof{figure}{A (silly) Python block. \label{lst:Python1}}
\begin{table}[htbp]
\caption{A (silly) Python table. \label{tab:Python1}}
\centering
\begin{tabular}{lll}
a1 & a2 & a3\\
b1 & b2 & b3\\
\end{tabular}
\end{table}
The table \ref{tab:Python1} is produced by the code \ref{lst:Python1}.
\subsection{A figure}
\label{sec:orgf75a27d}
A Python block producing a figure.
\begin{verbatim}
import matplotlib.pyplot as plt, numpy as np
from sympy import *
x=symbols("x")
f=lambda x:sin(x)/x
t=np.arange(-6*np.pi,6*np.pi, 0.1)
ft=[f(u) for u in t]
fig=plt.figure(figsize=(3,2))
plt.plot(t, ft, "b-")
fig.tight_layout()
plt.savefig("tstfig.pdf")
"tstfig.pdf"
\end{verbatim}
\captionof{figure}{A Python block producing a figure. \label{lst:Python2}}
\begin{figure}[htbp]
\centering
\includegraphics[width=.9\linewidth]{tstfig.pdf}
\caption{A (not so silly) figure produced by Python. \label{fig:Python2}}
\end{figure}
The figure \ref{fig:Python2} is produced by the code \ref{lst:Python2}.
\bibliographystyle{vancouver}
\bibliography{Minimal}
\end{document}
[-- Attachment #5: Min-Ref exported by org-pandoc-export-to-odt.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 17044 bytes --]
[-- Attachment #6: Min-Ref exported by org-latex-export-to-pdf.pdf --]
[-- Type: application/pdf, Size: 143423 bytes --]
[-- Attachment #7: Min-Ref exported by org-odt-export-to-odt.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 18946 bytes --]
[-- Attachment #8: Min-Ref exported by org-pandoc-export-to-latex-pdf.pdf --]
[-- Type: application/pdf, Size: 202284 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Problem with references to babel source blocks (possible bug).
@ 2018-12-19 19:26 Emmanuel Charpentier
2018-12-20 20:47 ` John Kitchin
0 siblings, 1 reply; 7+ messages in thread
From: Emmanuel Charpentier @ 2018-12-19 19:26 UTC (permalink / raw)
To: emacs-orgmode
I wish to be able to reference (i. e cross-references, lists) both some
tables or figures AND the code producing the objects.
To this effect, I added (distinct) #+caption:s to the source blocks AND
to the results, adorned with (distinct) org-ref's labels. An example (
Min-Ref.org) is included in this Google Drive directory*:
https://drive.google.com/drive/folders/1T6N_-WwphlnL2mB4f6BgX0u1K5mLnz4i?usp=sharing
.
The comparison of this source, the LaTeX code obtained by org-latex
export-to latex (Min-Ref.tex) and the resultant PDF (Min-Ref exported
by org-latex-export-to-pdf.pdf) show that the labels attributed to
source blocks are mislabeled as figures. Furthermore, while the org
source requests a list of figure, a list of table and a list of
listings (in that order), the list of figures appears *after* the list
of tables.
I am tempted to conclude that there is some confusion between figures
and listings. Further attempts tend to show that the problem may live n
the core org's code, rather than any specific exporter :
The ODT "native" exporter (org-odt-export-to-odt) is much less capable,
as shown in Min-Ref exported by org-odt-export-to-odt.odt.
Attempts to export via Pandoc to PDF (Min-Ref exported by org-pandoc-
export-to-latex-pdf.pdf), ODT (Min-Ref exported by org-pandoc-export-
to-odt.odt) and DOCX (Min-Ref.docx) show that these exporters may need
some specific configurations in order to be even vaguely usable.
Previous trials, using #+names: rather than org-ref's labels, gave
similar failures. If needed, I can reproduce these trials.
So I have a couple questions :
1) Is the confusion of source blocks and figures a bug, or do I miss a
subtle point ?
2) Is there some introductory material to the care and feeding of ox-
pandoc demonstrating the use of this exporter's options to enable the
addition of the needed features (figure inclusion, tables of tables /
figures / listings, etc...) ? The "manual" available as a README is way
too terse to be usable without diving in the source code and pandoc's
documentation.
Sincerely,
--
Emmanuel Charpentier
* Six attempts at posting those files attached to the present mail have
convinced me that the list manager rejects at least the messages
containing some attachments (docx ? dot ?) ; I'm a little bit fed up
with this...
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem with references to babel source blocks (possible bug).
2018-12-19 19:26 Emmanuel Charpentier
@ 2018-12-20 20:47 ` John Kitchin
2018-12-21 16:29 ` Emmanuel Charpentier
0 siblings, 1 reply; 7+ messages in thread
From: John Kitchin @ 2018-12-20 20:47 UTC (permalink / raw)
To: Emmanuel Charpentier; +Cc: emacs-orgmode
I guess there is some subtle point missing. For the source blocks I
usually use the minted package, which I think makes code blocks as a
listing float. In your tex file, they are verbatim environments, and you
have \captionof{figure} under them which is presumably why they are
labeled as figures.
Try adding ("" "minted" nil) to # org-latex-packages-alist:
and add this to an init file: (setq org-latex-listings 'minted).
Best wishes,
Emmanuel Charpentier <emanuel.charpentier@gmail.com> writes:
> I wish to be able to reference (i. e cross-references, lists) both some
> tables or figures AND the code producing the objects.
>
> To this effect, I added (distinct) #+caption:s to the source blocks AND
> to the results, adorned with (distinct) org-ref's labels. An example (
> Min-Ref.org) is included in this Google Drive directory*:
> https://drive.google.com/drive/folders/1T6N_-WwphlnL2mB4f6BgX0u1K5mLnz4i?usp=sharing
> .
>
> The comparison of this source, the LaTeX code obtained by org-latex
> export-to latex (Min-Ref.tex) and the resultant PDF (Min-Ref exported
> by org-latex-export-to-pdf.pdf) show that the labels attributed to
> source blocks are mislabeled as figures. Furthermore, while the org
> source requests a list of figure, a list of table and a list of
> listings (in that order), the list of figures appears *after* the list
> of tables.
>
> I am tempted to conclude that there is some confusion between figures
> and listings. Further attempts tend to show that the problem may live n
> the core org's code, rather than any specific exporter :
>
> The ODT "native" exporter (org-odt-export-to-odt) is much less capable,
> as shown in Min-Ref exported by org-odt-export-to-odt.odt.
>
> Attempts to export via Pandoc to PDF (Min-Ref exported by org-pandoc-
> export-to-latex-pdf.pdf), ODT (Min-Ref exported by org-pandoc-export-
> to-odt.odt) and DOCX (Min-Ref.docx) show that these exporters may need
> some specific configurations in order to be even vaguely usable.
>
> Previous trials, using #+names: rather than org-ref's labels, gave
> similar failures. If needed, I can reproduce these trials.
>
> So I have a couple questions :
>
> 1) Is the confusion of source blocks and figures a bug, or do I miss a
> subtle point ?
>
> 2) Is there some introductory material to the care and feeding of ox-
> pandoc demonstrating the use of this exporter's options to enable the
> addition of the needed features (figure inclusion, tables of tables /
> figures / listings, etc...) ? The "manual" available as a README is way
> too terse to be usable without diving in the source code and pandoc's
> documentation.
>
> Sincerely,
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem with references to babel source blocks (possible bug).
2018-12-20 20:47 ` John Kitchin
@ 2018-12-21 16:29 ` Emmanuel Charpentier
0 siblings, 0 replies; 7+ messages in thread
From: Emmanuel Charpentier @ 2018-12-21 16:29 UTC (permalink / raw)
To: John Kitchin; +Cc: emacs-orgmode
Dear John, dear list,
Indeed using minted works (at least when using labels. I have not yet
tried to use #+NAME:s). See a few remarks below.
Le jeu. 20 déc. 2018 à 21:47, John Kitchin <jkitchin@andrew.cmu.edu> a écrit :
>
> I guess there is some subtle point missing. For the source blocks I
> usually use the minted package, which I think makes code blocks as a
> listing float. In your tex file, they are verbatim environments, and you
> have \captionof{figure} under them which is presumably why they are
> labeled as figures.
>
> Try adding ("" "minted" nil) to # org-latex-packages-alist:
>
> and add this to an init file: (setq org-latex-listings 'minted).
The mistery starts with the "Src blocks" part of ox-latex (starting
line 895 in today's version of this file). In the default case (i. e.
when org-latex-listing is not set), this modules exports a verbatim
environment ... and a \labelof{figure} label !!!
Another part of the mystery is explained in the function
org-latex-keyword (starting at line 2218 of today's version of
org-latex.el). This function is, among others, in charge of
determining the environment of a table of contents for code snippets.
This tests org-latex-listings and switches :
nil --> listoffigures
minted --> listoflistings
otherwise --> lstlistoflitings
BTW, reading this code also allows to understand why org-mode complies
to #+TOC: headings, #+TOC: tables, #+TOC: listings, but NOT #+TOC:
figures.
I wonder why this choice has been made. Probably because this avoids
the need for a latex package for source code listings. hich is indeed
a bit of a quandary :
* listings is obsolete, unmaintained and has serious issues with
anything not strict ASCII (plays fast and loose with TeX catcodes...).
* minted needs to write and read intermediate file, which is a bt of a
security risk, hence not enabled by default.
The choice of figures as a default environment for code snippets has a
couple consequences :
* Problems at exporting anywhere but latex
* No way to have simultaneously a list of figures and list of listings
* No list of figures bt by direct use of "\listoffigures" in LaTeX.
Shouldn't we consider this a bit of a misdesign ? I dont (yet) seem a
way to en hance this.
Suggestions ?
--
Emmanuel Charpentier
> Best wishes,
>
> Emmanuel Charpentier <emanuel.charpentier@gmail.com> writes:
>
> > I wish to be able to reference (i. e cross-references, lists) both some
> > tables or figures AND the code producing the objects.
> >
> > To this effect, I added (distinct) #+caption:s to the source blocks AND
> > to the results, adorned with (distinct) org-ref's labels. An example (
> > Min-Ref.org) is included in this Google Drive directory*:
> > https://drive.google.com/drive/folders/1T6N_-WwphlnL2mB4f6BgX0u1K5mLnz4i?usp=sharing
> > .
> >
> > The comparison of this source, the LaTeX code obtained by org-latex
> > export-to latex (Min-Ref.tex) and the resultant PDF (Min-Ref exported
> > by org-latex-export-to-pdf.pdf) show that the labels attributed to
> > source blocks are mislabeled as figures. Furthermore, while the org
> > source requests a list of figure, a list of table and a list of
> > listings (in that order), the list of figures appears *after* the list
> > of tables.
> >
> > I am tempted to conclude that there is some confusion between figures
> > and listings. Further attempts tend to show that the problem may live n
> > the core org's code, rather than any specific exporter :
> >
> > The ODT "native" exporter (org-odt-export-to-odt) is much less capable,
> > as shown in Min-Ref exported by org-odt-export-to-odt.odt.
> >
> > Attempts to export via Pandoc to PDF (Min-Ref exported by org-pandoc-
> > export-to-latex-pdf.pdf), ODT (Min-Ref exported by org-pandoc-export-
> > to-odt.odt) and DOCX (Min-Ref.docx) show that these exporters may need
> > some specific configurations in order to be even vaguely usable.
> >
> > Previous trials, using #+names: rather than org-ref's labels, gave
> > similar failures. If needed, I can reproduce these trials.
> >
> > So I have a couple questions :
> >
> > 1) Is the confusion of source blocks and figures a bug, or do I miss a
> > subtle point ?
> >
> > 2) Is there some introductory material to the care and feeding of ox-
> > pandoc demonstrating the use of this exporter's options to enable the
> > addition of the needed features (figure inclusion, tables of tables /
> > figures / listings, etc...) ? The "manual" available as a README is way
> > too terse to be usable without diving in the source code and pandoc's
> > documentation.
> >
> > Sincerely,
>
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-12-21 16:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1669578320.377567952.1545064721537.JavaMail.root@zimbra43-e7.priv.proxad.net>
2018-12-17 16:40 ` Problem with references to babel source blocks (possible bug) emm.charpentier
2018-12-18 17:00 ` Emmanuel Charpentier
2018-12-19 19:26 Emmanuel Charpentier
2018-12-20 20:47 ` John Kitchin
2018-12-21 16:29 ` Emmanuel Charpentier
-- strict thread matches above, loose matches on Subject: below --
2018-12-19 16:05 Emmanuel Charpentier
2018-12-17 15:32 Emmanuel Charpentier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).