emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Thomas S. Dye" <tsd@tsdye.online>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Export LaTeX command inside figure environment
Date: Sat, 07 May 2022 20:06:20 -1000	[thread overview]
Message-ID: <87v8uga78j.fsf@tsdye.online> (raw)
In-Reply-To: <t57j8r$c4e$1@ciao.gmane.io>

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	other threads:[~2022-05-08  6:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-07 23:43 Export LaTeX command inside figure environment Thomas S. Dye
2022-05-08  0:30 ` Juan Manuel Macías
2022-05-08  0:57   ` Thomas S. Dye
2022-05-08  5:08   ` Max Nikulin
2022-05-08  6:06     ` Thomas S. Dye [this message]
2022-05-08 16:12       ` Juan Manuel Macías
2022-05-08 16:35       ` Max Nikulin

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=87v8uga78j.fsf@tsdye.online \
    --to=tsd@tsdye.online \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@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).