emacs-orgmode@gnu.org archives
help / color / mirror / code / Atom feed
* Putting LaTeX inside a figure environment on export
@ 2022-04-09 19:36 William Denton
2022-04-09 19:46  Jason Ross
From: William Denton @ 2022-04-09 19:36 UTC (permalink / raw)
To: emacs-orgmode

Is there a way to get a line of LaTeX inside a figure environment when
exporting from Org?

I've got a problem making an index of photographs where some of the photos are
large and get floated to a different page, and the page number in the index is
incorrect.

For example, let's say I have:

#+caption: This is a large tree
[[file:large_tree.jpg]]

When exported to LaTeX, this turns into:

\begin{figure}[htbp]
\centering
\includegraphics[width=.9\linewidth]{large_tree.jpg}
\caption{This is a large tree}
\end{figure}

I want to use this to generate an entry in an index:

\index[photos]{Tree}

Is there a way to get that *inside* the figure environment?  If it is, then the
page number is correct.

If it's outside, then the index will point to the page where that line sits in
the text, if you get what I mean.  If the figure would be in the middle of page
15 but is so big it gets floated to page 16, then the index will say 15 (where
the index command is), not 16 (where the image is).

Now that I've written this out I see I could make my own macro to do all this
(I'd pass in filename, caption, and indexing information, and generate that
LaTeX figure above with the index line inside), but is there a way built in to
Org to insert LaTeX like this when exporting?  From what I see in the manual
there isn't, one can only set attributes, not add a custom line, but I thought

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Putting LaTeX inside a figure environment on export
2022-04-09 19:36 Putting LaTeX inside a figure environment on export William Denton
@ 2022-04-09 19:46  Jason Ross
2022-04-09 20:04    William Denton
From: Jason Ross @ 2022-04-09 19:46 UTC (permalink / raw)
To: emacs-orgmode

On 4/9/22 12:36, William Denton wrote:
> Is there a way to get a line of LaTeX inside a figure environment when
> exporting from Org?

> For example, let's say I have:
>
>      #+caption: This is a large tree
>      [[file:large_tree.jpg]]

>
> I want to use this to generate an entry in an index:
>
>     \index[photos]{Tree}
>
> Is there a way to get that *inside* the figure environment?  If it is,
> then the page number is correct.

Does the following work?

#+caption: This is a large tree @@latex:\index[photos]{Tree}@@
[[file:large_tree.jpg]]

Resulting LaTeX:

\begin{figure}[htbp]
\centering
\includegraphics[width=.9\linewidth]{large_tree.jpg}
\caption{This is a large tree \index[photos]{Tree}}
\end{figure}
\end{document}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Putting LaTeX inside a figure environment on export
2022-04-09 19:46  Jason Ross
@ 2022-04-09 20:04    William Denton
0 siblings, 0 replies; 3+ messages in thread
From: William Denton @ 2022-04-09 20:04 UTC (permalink / raw)
To: emacs-orgmode

On 9 April 2022, Jason Ross wrote:

> Does the following work?
>
>    #+caption: This is a large tree @@latex:\index[photos]{Tree}@@
>    [[file:large_tree.jpg]]

By Jove, it does.  That's brilliant.  Thanks!

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-09 20:05 UTC | newest]

2022-04-09 19:46  Jason Ross

Code repositories for project(s) associated with this inbox:
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).`