On 08/05/2022 07:30, Juan Manuel Macías wrote:
Thomas S. Dye writes:
Is there a way to add an arbitrary LaTeX command between
\begin{figure} ... \end{figure} during LaTeX export? I want to end up
with the following snippet, but can't figure out how to slip in
\setfloatalignment{b}. \begin{figure}[htb]
\centering
\includegraphics[width=.9\linewidth]{hilbertcurves.pdf}
\caption[Hilbert curves]{\label{fig:orgparagraph1} Hilbert curves of
various degrees \emph{n}.}
\setfloatalignment{b}
\end{figure}
I think the :caption attribute could do the trick (of course everything
must be on one line):
#+ATTR_LaTeX: :caption \caption[Hilbert
curves]{\label{fig:orgparagraph1} Hilbert curves of various degrees
\emph{n}.}\setfloatalignment{b}
Would it work if \setfloatalignment{b} is added before \includegraphics?
From my point of view, it is still a hack due to abusing the :placement
attribute, but it is backend agnostic, so reuses caption for HTML and
relieves requirement of single long line:
#+caption[Hilbert curves]: Hilbert curves of various degrees \(n\)
#+name: orgparagraph1
#+attr_latex: :placement [b]\setfloatalignment{b}
[[file:hilbertcurves.pdf]]
# Local Variables:
# org-latex-prefer-user-labels: t
# End:
P.S. Math and absence of period are intentional. I never used tufte, so
unsure if something besides b is meaningful with \setfloatalignment{b}.
I dropped "ht" to make inconsistency apparent and expecting that when
figures are moved to the end of document, "ht" should be used instead
with removing of \setfloatalignment.