emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.com>
To: m43cap@yandex.com
Cc: emacs-orgmode@gnu.org
Subject: Re: Footnotes on line and not raised
Date: Mon, 11 Mar 2024 12:17:49 +0100	[thread overview]
Message-ID: <877ci93tlu.fsf@christianmoe.com> (raw)
In-Reply-To: <874jdd3xdt.fsf@yandex.com>

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.


      parent reply	other threads:[~2024-03-11 11:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11  9:56 Footnotes on line and not raised Colin Baxter
2024-03-11 10:12 ` Colin Baxter
2024-03-11 11:03   ` Juan Manuel Macías
2024-03-11 15:33     ` Colin Baxter
2024-03-11 11:17 ` Christian Moe [this message]

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=877ci93tlu.fsf@christianmoe.com \
    --to=mail@christianmoe.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=m43cap@yandex.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).