[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Are 'placement' and 'float' "obsolete terms" in inline images export
From: |
Juan Manuel Macías |
Subject: |
Re: Are 'placement' and 'float' "obsolete terms" in inline images export |
Date: |
Mon, 23 Oct 2023 19:00:08 +0000 |
Ihor Radchenko writes:
>> My suggestion is to add a :environment attribute next to another
>> :environment-options attr (or something like that, to introduce any
>> arbitrary LaTeX code). A LaTeX image can be enclosed in many environment
>> types, float or non-float.
>
> As I said above, I feel that :environment term will be overloaded then.
> What about :wrap?
I like :wrap. What's more, remembering that old thread where
some questions about code before/after the image were discussed,
what if the expected value of :wrap were a kind of template? This would
allow code to be placed before and/or after (not just an environment)
the image, always within the float environment, if it exists. Something
like this:
#+ATTR_LaTeX: :float nil :wrap
\begin{minipage}[b]{10pc}\small\n%s\n\end{minipage}
#+CAPTION: caption
[[file:foo.png]]
Thus :caption with value nil does not add any higher float environment
and would enclose (always within the template) the value of #+CAPTION as
\captionof{figure}{caption}. Of course, with a float environment
declared, :wrap can still be used. An internal environment is unlikely
(I can't think of any use case right now), but you can add arbitrary
code like \captionsetup{} or \ContinuedFloat, which should always go
inside the float environment.
The result of the previous example could also be obtained with:
#+ATTR_LaTeX: :float minipage :placement [b]{10pc} :caption
\captionof{figure}{caption}
[[file:foo.png]]
I don't know if it would be appropriate to explain in the Manual that
doing so would not be... "correct"? I don't know if there is any term in
programming to designate these situations which, without being bugs, are
functionalities not consciously sought...
>> ... However, :float can still be useful for
>> certain combinations. For example, a minipage environment cannot include
>> a caption (it produces an error of the type "LaTeX Error: \caption
>> outside float").
>
> Do we know in advance which environments support \caption and which not?
> I feel that we may handle this programmatically without creating an array
> of almost-identical attributes.
I like the idea, but unfortunately, apart from the known float
environments, there are those that a user can define using the \newfloat
command from the float package.
--
Juan Manuel Macías
https://juanmanuelmacias.com
https://lunotipia.juanmanuelmacias.com
https://gnutas.juanmanuelmacias.com