emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Export LaTeX command inside figure environment


From: Thomas S. Dye
Subject: Re: Export LaTeX command inside figure environment
Date: Sat, 07 May 2022 20:06:20 -1000
User-agent: mu4e 1.4.15; emacs 27.1

Aloha Max,

Max Nikulin <manikulin@gmail.com> writes:

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.

Yes, this works, too.  It is a convenient hack. Thanks!

It would be better to have a LaTeX attribute, say :commands, that places commands within \begin{figure} ... \end{figure}.

I'm circling back to Tufte handouts for a course I'm offering in the Fall. It is great that ox-latex has the flexibility to export to tufte-latex now. I haven't prepared any handouts yet, but all the pieces seem to work in a straightforward way. Org-cite is performing like a champ, too!

All the best,
Tom
--
Thomas S. Dye
https://tsdye.online/tsdye



reply via email to

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