[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [emacs-humanities] Images in org mode

From: Juan Manuel Macías
Subject: Re: [emacs-humanities] Images in org mode
Date: Wed, 17 Aug 2022 14:33:18 +0000

Hi, Richard,

Richard Teverson writes:

> Dear All,
> I’m on the hunt for good ideas about how to write image-heavy academic
> papers in org mode, and then export them sensibly to Word, which is
> typically the required final format in my field.
> I’m looking for three things:
> 1 How do people store images during the research and writing phase? I find:
> +#NAME:
> [[link]]
> in the document rather awkward to keep altogether during the chaos
> that is writing. Do people give them their own block, or file or
> subtree? Is there a genius package out there somewhere to link images
> + captions to a subtree?

You might want to take a look at org-attach, which allows you to attach
a directory to an Org node. I also use org-publish a lot, both for my
blogs and to work on books (with output to LaTeX/pdf). Perhaps for small
projects like academic articles, org-publish is too much. But for
projects of a certain scope, such as books, it is certainly very useful,
since it allows you to have all the parts of the project conveniently
ordered, and you can also establish a default directory for the images.



On the other hand, I recently wrote this little package that allows you
to easily navigate (using Helm) through the images, blocks, and tables
in a document:


> 2 Does anyone have an automatic way to number images, rather than
> having to change the numbers whenever a new image is added,

Do you mean automatically create a #+name keyword for the image every
time you add one?

> and/or a way to move all the images at once to an appendix at the end?
> (Some journals like the images in the text, some at the end)

For my work I wrote something a long time ago that doesn't do exactly
what you're looking for, but maybe you could adapt it to your workflow.
This function (when called inside dired) inserts in a temporal org
document, as org links, all the images stored in the current directory.

#+begin_src emacs-lisp
  (defun my-org-img-dired-preview ()
    (if (not (derived-mode-p 'dired-mode))
        (error "not in dired")
      (let* ((dir-name default-directory)
             (buf (concat "*" dir-name "--images *")))
        (setq my-img-dired-list nil)
          (goto-char (point-min))
          (while (re-search-forward "\\.png\\|\\.jpg\\|\\.tif" nil t)
            (let* ((img-path (dired-get-filename)))
              (add-to-list 'my-img-dired-list img-path t))))
        (when (get-buffer buf)
          (kill-buffer buf))
        (get-buffer-create buf)
        (set-buffer buf)
        (let ((img-list (mapconcat (lambda (el)
                                     (let ((link (concat "[[file:" el "]]")))
              (img-num (number-to-string
                        (length my-img-dired-list))))
          (insert (concat "* Images in " dir-name "\n\n"))
          (insert (concat img-num " files:\n\n"))
          (insert img-list)
        (pop-to-buffer buf)

> 3 What’s the most robust export path / set up for images? I’ve found
> odt sometimes just gives up,

Can you give please an example where exporting to odt has given you a problem
with images?

> and latex is usually pretty reliable (but
> the worst format for pandoc to put into word). Pandoc org—>word never
> does images for me.

Indeed, it's not a good idea to export from LaTeX to odt/docx via pandoc.
An alternative could be to export using tex4ht, which is included in
texlive and respects the LaTeX format better. But with certain caveats:


Best regards,

Juan Manuel

Juan Manuel Macías




reply via email to

[Prev in Thread] Current Thread [Next in Thread]