all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [BUG] Org-mode Side-by-Side Images [9.5.3 (release_9.5.3-3-gd54104)]
@ 2023-01-26 12:24 Gustaf Waldemarson
  2023-02-13 14:48 ` [FR] Side-by-side images during export (was: [BUG] Org-mode Side-by-Side Images [9.5.3 (release_9.5.3-3-gd54104)]) Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Gustaf Waldemarson @ 2023-01-26 12:24 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 14208 bytes --]

Hello!

This is a small issue that have vexed me a number of times when I've
been writing up a report or something where I want to export the results
into multiple formats (such as both LaTeX and HTML in the below
example).

At least for me, it is very common to want to display more than one
image side-by-side, but so far I haven't been able to find any solution
that really works in all regards. The example document below shows some
of the things I've tried and mentions some of the issues:


#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside]
#+LATEX_HEADER: \usepackage{svg}
#+LATEX_HEADER: \usepackage{subcaption}
#+LATEX_HEADER: \usepackage{placeins}
#+LATEX_HEADER: \usepackage{float}
#+LATEX_HEADER: \usepackage{wrapfig}
#+LATEX_HEADER: \usepackage{graphicx}
#+LATEX_HEADER: \usepackage{xspace}
#+LATEX_HEADER: \captionsetup[subfigure]{labelformat=empty}

#+NAME: a
#+BEGIN_SRC dot :file /tmp/a.png :cmdline -Tpng -Gsize=9,15\! -Gdpi=10
  digraph {
  1 -> 2;
  2 -> 3;
  }
#+END_SRC

#+NAME: b
#+BEGIN_SRC dot :file /tmp/b.png :cmdline -Tpng -Gsize=9,15\! -Gdpi=10
  digraph {
  1 -> 3;
  2 -> 3;
  }
#+END_SRC

* LaTeX

  #+BEGIN_CENTER
  #+ATTR_LATEX: :height 0.4\textwidth :center
  #+RESULTS: a
  [[file:/tmp/a.png]]
  #+ATTR_LATEX: :height 0.4\textwidth :center
  #+RESULTS: b
  [[file:/tmp/b.png]]
  #+END_CENTER

* HTML

  (Works, but can't control height for both images.)

  #+ATTR_HTML: :align center :height 300
  [[/tmp/a.png]]
  [[/tmp/b.png]]


* HTML + LaTeX

  Works in both HTML and LaTeX but disables per-image attributes (:height,
  :center etc). Additionally, images in tabular environments tend to be a
bit
  fragile in LaTeX depending on which document style is being used. Also
adds
  undesired lines above/below the table.

  #+ATTR_HTML: :align center
  | [[/tmp/a.png]] | [[/tmp/b.png]] |


* LaTeX Only

  LaTeX example using the common 'subfigure' package.

  \begin{figure}
      \centering
       \begin{subfigure}[c]{0.5\textwidth}
          \centering
          \includegraphics[width=0.9\textwidth]{/tmp/a.png}
          \caption{a.png}
       \end{subfigure}
       \begin{subfigure}[c]{0.3\textwidth}
          \centering
          \includegraphics[width=0.9\textwidth]{/tmp/b.png}
          \caption{b.png}
       \end{subfigure}
     \caption{Subfigures}%
   \end{figure}


  This question was originally asked almost 5 years ago on
  [[
https://emacs.stackexchange.com/questions/38745/orgmode-image-export-side-by-side-to-both-latex-and-html][Emacs
  Stack Exchange]], but so far only have a very limited solution in my
  opinion. Ideally, I'm looking for some kind of org-mode environment
  that could export to most backends (at least HTML and LaTeX) without
  duplicating the image exports for each of them individually.

  Does something like that already exist in org-mode? Alternatively,
  what is the recommended and most portable approach to placing images
  side-by-side?

  Best Regards,
  Gustaf


Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.20, cairo version 1.16.0)
 of 2022-05-04
Package: Org mode version 9.5.3 (release_9.5.3-3-gd54104 @
/home/guswal01/.local/share/emacs/29.0.50/lisp/org/)

current state:
==============
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-directory "/home/guswal01/.config/emacs/org/"
 org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-log-into-drawer t
 org-latex-images-centered nil
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-odt-format-inlinetask-function
'org-odt-format-inlinetask-default-function
 org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
                  org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
 org-modules '(org-tempo ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus
ol-info ol-irc ol-mhe
               ol-rmail ol-eww)
 org-mode-hook '(org-tempo-setup
                 #[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook org-show-all append
local] 5]
                 #[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook
org-babel-show-result-all append local]
                   5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes
                 #[0 "\301\211 \207" [imenu-create-index-function
org-imenu-get-tree] 2]
                 my-org-hook turn-on-org-cdlatex)
 org-babel-load-languages '((emacs-lisp . t) (dot . t) (ditaa . t) (python
. t)
                            (gnuplot . t) (shell . t) (org . t) (plantuml .
t) (latex . t))
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-adapt-indentation 'headline-data
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-export-before-processing-hook '(my/org-inline-css-hook)
 org-latex-classes '(("acmart" "\\documentclass{acmart}"
                      ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}")
                      ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                      ("\\paragraph{%s}" . "\\paragraph*{%s}")
                      ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
                     ("article" "\\documentclass[11pt]{article}"
                      ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}")
                      ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                      ("\\paragraph{%s}" . "\\paragraph*{%s}")
                      ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
                     ("report" "\\documentclass[11pt]{report}"
                      ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" .
"\\chapter*{%s}")
                      ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}")
                      ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
                     ("book" "\\documentclass[11pt]{book}" ("\\part{%s}" .
"\\part*{%s}")
                      ("\\chapter{%s}" . "\\chapter*{%s}")
                      ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}")
                      ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
                     )
 org-highlight-latex-and-related '(latex)
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-tangle-lang-exts '(("latex" . "tex") ("python" . "py")
("emacs-lisp" . "el")
                              ("elisp" . "el"))
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-latex-default-packages-alist '(("AUTO" "inputenc" t ("pdflatex"))
                                    ("T1" "fontenc" t ("pdflatex")) (""
"graphicx" t)
                                    ("" "longtable" nil) ("" "wrapfig" nil)
                                    ("" "rotating" nil) ("normalem" "ulem"
t)
                                    ("" "amsmath" t) ("" "capt-of" nil) (""
"hyperref" nil))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-latex-listings 'minted
 org-html-head-extra "<style type=\"text/css\">\n pre.src{background-color:
#2e3436; color: #eeeeec;}</style>\n<style type=\"text/css\">\n
pre.src{background-color: #2e3436; color: #eeeeec;}</style>\n<style
type=\"text/css\">\n pre.src{background-color: #2e3436; color:
#eeeeec;}</style>\n<style type=\"text/css\">\n pre.src{background-color:
#2e3436; color: #eeeeec;}</style>\n<style type=\"text/css\">\n
pre.src{background-color: #2e3436; color: #eeeeec;}</style>\n<style
type=\"text/css\">\n pre.src{background-color: #2e3436; color:
#eeeeec;}</style>\n<style type=\"text/css\">\n pre.src{background-color:
#2e3436; color: #eeeeec;}</style>\n<style type=\"text/css\">\n
pre.src{background-color: #2e3436; color: #eeeeec;}</style>\n<style
type=\"text/css\">\n pre.src{background-color: #2e3436; color:
#eeeeec;}</style>\n<style type=\"text/css\">\n pre.src{background-color:
#2e3436; color: #eeeeec;}</style>\n<style type=\"text/css\">\n
pre.src{background-color: #2e3436; color: #eeeeec;}</style>\n<style
type=\"text/css\">\n pre.src{background-color: #2e3436; color:
#eeeeec;}</style>\n<style type=\"text/css\">\n pre.src{background-color:
#2e3436; color: #eeeeec;}</style>\n<style type=\"text/css\">\n
pre.src{background-color: #2e3436; color: #eeeeec;}</style>\n<style
type=\"text/css\">\n pre.src{background-color: #2e3436; color:
#eeeeec;}</style>\n<style type=\"text/css\">\n pre.src{background-color:
#2e3436; color: #eeeeec;}</style>\n<style type=\"text/css\">\n
pre.src{background-color: #2e3436; color: #eeeeec;}</style>\n<style
type=\"text/css\">\n pre.src{background-color: #2e3436; color:
#eeeeec;}</style>\n<style type=\"text/css\">\n pre.src{background-color:
#2e3436; color: #eeeeec;}</style>\n<style type=\"text/css\">\n
pre.src{background-color: #2e3436; color: #eeeeec;}</style>\n<style
type=\"text/css\">\n pre.src{background-color: #2e3436; color:
#eeeeec;}</style>\n<style type=\"text/css\">\n pre.src{background-color:
#2e3436; color: #eeeeec;}</style>\n<style type=\"text/css\">\n
pre.src{background-color: #2e3436; color: #eeeeec;}</style>\n<style
type=\"text/css\">\n pre.src{background-color: #2e3436; color:
#eeeeec;}</style>\n<style type=\"text/css\">\n pre.src{background-color:
#2e3436; color: #eeeeec;}</style>\n<style type=\"text/css\">\n
pre.src{background-color: #2e3436; color: #eeeeec;}</style>\n<style
type=\"text/css\">\n pre.src{background-color: #2e3436; color:
#eeeeec;}</style>\n<style type=\"text/css\">\n pre.src{background-color:
#2e3436; color: #eeeeec;}</style>\n<style type=\"text/css\">\n
pre.src{background-color: #2e3436; color: #eeeeec;}</style>\n"
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-latex-prefer-user-labels t
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-export-backends '(ascii html latex odt)
 org-confirm-babel-evaluate nil
 org-latex-format-inlinetask-function
'org-latex-format-inlinetask-default-function
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-pre-tangle-hook '(save-buffer)
 org-agenda-loop-over-headlines-in-active-region nil
 org-occur-hook '(org-first-headline-recenter)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("attachment" :follow org-attach-follow :complete
                        org-attach-complete-link)
                       ("id" :follow org-id-open)
                       ("treemacs" :store treemacs-store-org-link)
                       ("eww" :follow org-eww-open :store
org-eww-store-link)
                       ("rmail" :follow org-rmail-open :store
org-rmail-store-link)
                       ("mhe" :follow org-mhe-open :store
org-mhe-store-link)
                       ("irc" :follow org-irc-visit :store
org-irc-store-link :export
                        org-irc-export)
                       ("info" :follow org-info-open :export
org-info-export :store
                        org-info-store-link)
                       ("gnus" :follow org-gnus-open :store
org-gnus-store-link)
                       ("docview" :follow org-docview-open :export
org-docview-export :store
                        org-docview-store-link)
                       ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
                       ("bbdb" :follow org-bbdb-open :export
org-bbdb-export :complete
                        org-bbdb-complete-link :store org-bbdb-store-link)
                       ("w3m" :store org-w3m-store-link) ("file+sys")
("file+emacs")
                       ("shell" :follow org-link--open-shell)
                       ("news" :follow
                        #[514 "\301\300\302 Q \"\207" ["news" browse-url
":"] 6
                          "\n\n(fn URL ARG)"]
                        )
                       ("mailto" :follow
                        #[514 "\301\300\302 Q \"\207" ["mailto" browse-url
":"] 6
                          "\n\n(fn URL ARG)"]
                        )
                       ("https" :follow
                        #[514 "\301\300\302 Q \"\207" ["https" browse-url
":"] 6
                          "\n\n(fn URL ARG)"]
                        )
                       ("http" :follow
                        #[514 "\301\300\302 Q \"\207" ["http" browse-url
":"] 6
                          "\n\n(fn URL ARG)"]
                        )
                       ("ftp" :follow
                        #[514 "\301\300\302 Q \"\207" ["ftp" browse-url
":"] 6
                          "\n\n(fn URL ARG)"]
                        )
                       ("help" :follow org-link--open-help :store
org-link--store-help)
                       ("file" :complete org-link-complete-file)
                       ("elisp" :follow org-link--open-elisp))
 org-html-format-headline-function
'org-html-format-headline-default-function
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-latex-pdf-process '("latexmk -shell-escape -bibtex -f -pdf %f")
 org-src-lang-modes '(("plantuml" . plantuml) ("C" . c) ("C++" . c++)
("asymptote" . asy)
                      ("bash" . sh) ("beamer" . latex) ("calc" .
fundamental) ("cpp" . c++)
                      ("ditaa" . artist) ("dot" . fundamental) ("elisp" .
emacs-lisp)
                      ("ocaml" . tuareg) ("screen" . shell-script) ("shell"
. sh)
                      ("sqlite" . sql))
 org-tab-before-tab-emulation-hook '(org-tempo-complete-tag)
 )

[-- Attachment #2: Type: text/html, Size: 18604 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-14  7:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-26 12:24 [BUG] Org-mode Side-by-Side Images [9.5.3 (release_9.5.3-3-gd54104)] Gustaf Waldemarson
2023-02-13 14:48 ` [FR] Side-by-side images during export (was: [BUG] Org-mode Side-by-Side Images [9.5.3 (release_9.5.3-3-gd54104)]) Ihor Radchenko
2023-02-14  7:58   ` Jean Louis

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.