[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Footnotes on line and not raised
From: |
Christian Moe |
Subject: |
Re: Footnotes on line and not raised |
Date: |
Mon, 11 Mar 2024 12:17:49 +0100 |
User-agent: |
mu4e 1.2.0; emacs 27.2 |
Hi,
The footnote definitions are easy to fix with CSS since they are wrapped
in divs with the .footdef class.
#+begin_src css
.footdef sup { vertical-align: baseline; font-size: 100%; }
#+end_src
But as you point out, the footnote references, are not as
straigthforward given the <sup><a class="footref"> structure -- at least
if you need other superscripts.
If you're not very concerned about cross-browser support, you can use
the :has() selector. Works fine in an up-to-date Firefox, but that's all
I'll promise.
#+begin_src css
sup:has(.footref) { vertical-align: baseline; font-size: 100%; }
#+end_src
Otherwise, I think you'll need an export filter. Here's one that simply
sets the .footref class on the SUP element as well:
#+begin_src elisp
(defun my-html-filter-footnotes (footnote backend info)
"Export footnote references with a class definition on the SUP
element to make them more amenable to CSS."
(when (org-export-derived-backend-p backend 'html)
(replace-regexp-in-string
"<sup>" "<sup class=\"footref\">" footnote)))
(add-to-list 'org-export-filter-footnote-reference-functions
'my-html-filter-footnotes)
#+end_src
Now it's easy to style the footnote reference with
#+begin_src css
sup.footref { vertical-align: baseline; font-size: 100%; }
#+end_src
One could perhaps make the case that Org ought to do this by default.
Yours,
Christian
Colin Baxter writes:
> I use footnotes as [fn:1], etc. in an org-mode file which I then export
> to html. In the output, I see the footnotes raised slightly above the
> line. I do not want this. Instead, I would like the footnotes to be on
> the line. Is this possible?
>
> I have read the doc strings associated with the variables
> `org-footnote-define-inline' and `org-footnote-auto-adjust', but,
> frankly, I am none the wiser.
>
> Best Wishes,
>
> Colin Baxter.