linktohack / ox-latex-subfigure Goto Github PK
View Code? Open in Web Editor NEWTurn table into subfigure. More or less a hack atm, easy to incorporate to org-mode though
License: GNU General Public License v3.0
Turn table into subfigure. More or less a hack atm, easy to incorporate to org-mode though
License: GNU General Public License v3.0
Hello. Thank you very much for your package.
I want to let you know that it is currently braking my table.el for some reasons. I commented the sections of my .emacs where ox-latex-subfigure is, and table.el is working again. I get a wrong-type-argument integer-or-marker-p nil
. I checked the issues in the repo, and I don't think that it's the same as #6
I'm attaching my configuration for org-mode.
org-mode.txt
In my org-mode setup I need to have the option "Org Latex Tables Centered" disabled, because of issues when using threeparttable and sidewaystable (see link)
https://www.mail-archive.com/[email protected]/msg104079.html
To still center all float environments I inserted:
But this does not work with ox-latex-subfigure, and :align option only allows for t,c,b
Is there some possibility to get \centering on export with "Org Latex Tables Centered" disabled?
Or could you indicate what to change in your code to get that behaviour (I see \centering at various points, but do not know where to change it). In my use case I would always center align, so no need for any conditional....
Hi,
First of all, thank you for this package, very useful! :)
I would like to be able to tune the size of the subfigures, ideally individually, but at least setting one default size.
For now, it seems it takes the default width defined by =org-latex-image-default-option= or =org-latex-image-default-width=.
Can I tune that for subfigures? Like having one variable =org-latex-subfigure-width=?
Thanks
Hi,
I just updated to last version, and I have a problem of additional \end{subfigure}
added as shown in the below generated latex code.
\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.3\linewidth}\centering
\includegraphics[\end{subfigure}
]{nyquist_point.png}
\caption{\label{fig:nyquist_point} Point receptance}
\end{subfigure}
\begin{subfigure}[b]{0.3\linewidth}\centering
\includegraphics[]{nyquist_transfer.png}
\caption{\label{fig:nyquist_transfer} Transfer receptance}
\end{subfigure}
\caption{\label{fig:nyquist_frf_plots}
Nyquist FRF plot for proportionally-damped system}
\end{figure}
I had not this problem previously.
Thanks :)
Sorry if i am doing something stupid.
I loaded ox-latex-subfigure and created a little table analog to the README:
#+NAME: fig:nogora
#+CAPTION: Blablabla
#+ATTR_LATEX: :environment subfigure :width 0.4\textwidth :align c
| file:../nogora/ecalhisto.pdf | file:../nogora/ecalhisto-cut.pdf |
When exporting (i.e. C-e l l) I get the error message "wrong-type-argument integer-or-marker-p nil".
It seems to refer to the call to text-properties-at
in line 12. of the .el file, with pt
being nil.
Below is the backtrace:
Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
text-properties-at(nil "\begin{center}\n\begin{subfigure}{0.4\textwidth}{c}\n\begin{center}\n\includegraphics[width=.9\linewidth]{../nogora/ecalhisto.pdf}\n\end{center} & \begin{center}\n\includegraphics[width=.9\linewidth]{../nogora/ecalhisto-cut.pdf}\n\end{center}\\\n\end{subfigure}\n\end{center}\n\n")
(plist-get (text-properties-at pt text) :parent)
(setq pt (next-property-change pt text) cell (plist-get (text-properties-at pt text) :parent) table (org-export-get-parent-table cell))
(while (or (not table) (not pt)) (setq pt (next-property-change pt text) cell (plist-get (text-properties-at pt text) :parent) table (org-export-get-parent-table cell)))
(let ((pt 0) cell table attr env limit) (while (or (not table) (not pt)) (setq pt (next-property-change pt text) cell (plist-get (text-properties-at pt text) :parent) table (org-export-get-parent-table cell))) (setq attr (org-export-read-attribute :attr_latex table) env (plist-get attr :environment) limit (string-to-int (or (plist-get attr :limit) "0"))) (if (not (string= "subfigure" env)) text (let ((temp-buffer (generate-new-buffer " temp"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert text) (goto-char 1) (link/latex-table-to-subfigure limit) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))))
(progn (let ((pt 0) cell table attr env limit) (while (or (not table) (not pt)) (setq pt (next-property-change pt text) cell (plist-get (text-properties-at pt text) :parent) table (org-export-get-parent-table cell))) (setq attr (org-export-read-attribute :attr_latex table) env (plist-get attr :environment) limit (string-to-int (or (plist-get attr :limit) "0"))) (if (not (string= "subfigure" env)) text (let ((temp-buffer (generate-new-buffer " temp"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert text) (goto-char 1) (link/latex-table-to-subfigure limit) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))))
(if (org-export-derived-backend-p backend (quote latex)) (progn (let ((pt 0) cell table attr env limit) (while (or (not table) (not pt)) (setq pt (next-property-change pt text) cell (plist-get (text-properties-at pt text) :parent) table (org-export-get-parent-table cell))) (setq attr (org-export-read-attribute :attr_latex table) env (plist-get attr :environment) limit (string-to-int (or (plist-get attr :limit) "0"))) (if (not (string= "subfigure" env)) text (let ((temp-buffer (generate-new-buffer " temp"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ... ... ...) (and ... ...))))))))
link/org-export-table-to-subfigure("\begin{center}\n\begin{subfigure}{0.4\textwidth}{c}\n\begin{center}\n\includegraphics[width=.9\linewidth]{../nogora/ecalhisto.pdf}\n\end{center} & \begin{center}\n\includegraphics[width=.9\linewidth]{../nogora/ecalhisto-cut.pdf}\n\end{center}\\\n\end{subfigure}\n\end{center}\n\n" latex (:export-options nil :back-end [cl-struct-org-export-backend latex nil ((bold . org-latex-bold) (center-block . org-latex-center-block) (clock . org-latex-clock) (code . org-latex-code) (drawer . org-latex-drawer) (dynamic-block . org-latex-dynamic-block) (entity . org-latex-entity)
...
When exporting normal figures I can insert a shortcaption for the table of figures (whole caption looks pretty bad there.
With subfigure this does not work. When inserting #+caption[short]long then neither gets exported.
I tried with
and also no luck...
Minimal example:
figure 1
| This is a subcation of the first image | This is a subcaption of the second image. |
| figure 1 | figure 2 |
@conao3 ?
Only the captions were updated but no figures were exported. So I updated today.
Now I only get the error message:
if: Search failed: "\\\\
?"
Hello,
I tried ox-latex-subfigure today. I loaded it with the code you provided and tried your minimal example,
changing path of both of course. It still exports to table...
What am I doing wrong?
\begin{table}[!htbp]
\caption{\label{fig:hello}
Use figure/subfigure instead of tabular, remember to set \texttt{:environment}}
\begin{subfigure}{0.4\textwidth}{c}
\includegraphics{/home/mcg/picture1.jpg} & \includegraphics{/home/mcg/picture2.jpg}
tttttt & zzzzzz
\end{subfigure}
\end{table}
\end{document}
I get this error when installing:
(error "Package lacks a file header")
Issue is fixed here:
https://github.com/tdehaeze/ox-latex-subfigure/blob/master/ox-latex-subfigure.el
Hi!
I like this package. Do you have an idea to add this package to MELPA?
Registering with MELPA allows more Emacs users to use this package.
If you think it is troublesome, I will Fork and register. If you don't like having too many repositories, you can help with ongoing maintenance by making me a collaborator.
Best,
Hello, thanks for working on this package.
Unfortunately, I have an issue when not including 'subfigure
in the org-latex-caption-above
list.
In particular, the \centering
command is written below the subfigure commands
, all the way below right before \end{figure}
and therefore doesn't affect the images.
See for example the org snippet
#+NAME: fig:runway-example-both
#+CAPTION: Example of /content/ and /style/ decomposition.
#+ATTR_LATEX: :environment subfigure :width 0.45\textwidth :align c
| [[./figs/airstrip_imgs.png]] | [[./figs/airstrip_imgs2.png]] |
| Maintaining content, changing style. | Maintaining style, changing content. |
and the generated latex snippet
\begin{figure}[htbp]
\begin{subfigure}[c]{0.45\textwidth}
\includegraphics[width=.9\linewidth]{./figs/airstrip_imgs.png}
\caption{Maintaining content, changing style.}
\end{subfigure}
\begin{subfigure}[c]{0.45\textwidth}
\includegraphics[width=.9\linewidth]{./figs/airstrip_imgs2.png}
\caption{Maintaining style, changing content.}
\end{subfigure}
\caption{\label{tab:org5683d81}Example of \emph{content} and \emph{style} decomposition.}
\centering
\end{figure}
The same also happens for the example snippet in the readme. Unfortunately I have not been able to figure out a solution myself.
I think it would be nice if it were possible to add a default subfigure options using something like like:
#+BIND: org-subfigure-default-option "height=2cm"
Then, if the third row of a table is not set:
#+name: fig:force_deflection_characteristics
#+caption: Force-deflection characteristics
#+attr_latex: :environment subfigure :width 0.32\linewidth :align t
| file:dry_friction.png | file:viscous_damper.png |
| <<fig:dry_friction>> Dry friction | <<fig:viscous_damper>> Viscous damper |
It would produce:
\begin{figure}[htbp]
\centering
\begin{subfigure}[t]{0.32\linewidth}\centering
\includegraphics[height=2cm]{dry_friction.png}
\caption{\label{fig:dry_friction} Dry friction}
\end{subfigure}
\begin{subfigure}[t]{0.32\linewidth}\centering
\includegraphics[height=2cm]{viscous_damper.png}
\caption{\label{fig:viscous_damper} Viscous damper}
\end{subfigure}
\caption{\label{fig:force_deflection_characteristics}
Force-deflection characteristics}
\end{figure}
Thanks :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.