emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: mahmood sheikh <mahmod.m2015@gmail.com>
To: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: figures not exported properly by ox-latex
Date: Thu, 11 Jul 2024 15:47:51 +0300	[thread overview]
Message-ID: <CAOj1L_fVzASpbgXSQs1qDFTOKoYa+QLJqnVs+BRef5jEYOeOog@mail.gmail.com> (raw)
In-Reply-To: <CAOj1L_foFTq63n38Rf+BK8rxz6Y6jwn8daMOY_MNqnd6iD79SQ@mail.gmail.com>

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

im fairly certain that at the time i sent this email, ox-latex was failing
to insert \label and \caption too after images in latex exports (like
ox-html to html exports). but perhaps someone made a change that fixed that.
the fact that ox-latex even inserts \caption and \label tells me that it
was the intention of the maintainer of ox-latex to handle latex blocks
preceded by a `#+caption` as figures. so it would be natural if org
inserted the figure environment itself like it does with images preceded by
`#+caption`. i hope this reasoning does make sense to you?
in ox-html, the function `org-html--wrap-image` is used to wrap an exported
image with a `<figure>` html environment with a caption and label, but it
doesnt happen for me.
after some more digging, i think inserting the `figure` environments
automatically in latex exports may be undesired behavior and it would be
preferred that the user do that themselves in the org document, because
`org-latex--caption/label-string` checks for a `figure` or `listing`
environment apparently, which tells me that the author expected the user to
insert the figure environment themselves. another reason is that the user
may use another, differently environment that accepts a \caption too.
thanks
p.s. sorry i keep hitting the "forward" button instead of the "forward all"
button so you may receive duplicate emails.

On Thu, Jul 11, 2024 at 11:59 AM mahmood sheikh <mahmod.m2015@gmail.com>
wrote:

> this is an example of what i mean:
> #+begin_src org
>   #+name: fig-switching-circuit-kmap-1
>   #+caption: karnaugh table of \(p\)
>   \begin{tikzpicture}
>     \karnaughmap[function=, defaultmap=8, omitzeros=false, omitidx,
> variables=xyz]{01101001}
>   \end{tikzpicture}
> #+end_src
> i vaguely recall org mode automatically turning captioned
> tikzpicture's into figures by wrapping them in a figure environment.
> currently, this is what i get when i export to latex:
> #+begin_src latex
>   \begin{tikzpicture}
>     \karnaughmap[function=, defaultmap=8, omitzeros=false, omitidx,
> variables=xyz]{01101001}
>     \caption{\label{fig-switching-circuit-kmap-1}karnaugh table of \(p\)}
>   \end{tikzpicture}
> a tikzpicture environment doesnt expect a \caption and therefore this
> gives an error. to avoid this the environment has to be wrapped manually by
> the user by a \begin{figure} environment, but i think this may be redundant
> because anything that takes a #+caption is expected to be a figure.
> also, ox-html doesnt handle those anymore, it used to handle #+caption:
> and insert it into the generated html output, it simply ignores that now.
> example:
> #+begin_src org
>   #+name: fig-switching-circuit-1
>   #+caption: implementation of \(p\)
>   [[attachment:circuit.svg]]
> #+end_src
> ox-html generates the following html:
> #+begin_src html
>   <img src="/circuit.svg" /><br />
> #+end_src
> its not a different problem, its basically that after the new overhaul
> figures are being handled differently than i recall, but i cant say for
> sure. although the report above about the exported circuit.svg img does
> make sense even if it wasnt handled the way i'd expect before the overhaul.
> thanks
>
> On Thu, Jul 11, 2024 at 11:47 AM Karthik Chikmagalur <
> karthikchikmagalur@gmail.com> wrote:
>
>> > it might've been fixed for figures as its been a while, but shouldnt
>> > latex environments with #+caption: and #+name: above them be exported
>> > as figures? because currently the user has to write \begin{figure} and
>> > \end{figure} explicitly which would work
>>
>> This is not the case.  The LaTeX output I posted in my previous response
>> was the exported output from your example Org source.  I did not add the
>> \begin{figure} and \end{figure} tags manually.
>>
>> Karthik
>>
>

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

      reply	other threads:[~2024-07-11 12:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 11:39 figures not exported properly by ox-latex mahmood sheikh
2024-02-02 11:46 ` Ihor Radchenko
2024-07-05  9:20   ` mahmood sheikh
2024-07-09 20:15 ` Karthik Chikmagalur
2024-07-11  8:39   ` mahmood sheikh
2024-07-11  8:46     ` Ihor Radchenko
2024-07-11  8:47     ` Karthik Chikmagalur
2024-07-11  8:59       ` mahmood sheikh
2024-07-11 12:47         ` mahmood sheikh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOj1L_fVzASpbgXSQs1qDFTOKoYa+QLJqnVs+BRef5jEYOeOog@mail.gmail.com \
    --to=mahmod.m2015@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=karthikchikmagalur@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).