emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Footnotes on line and not raised
@ 2024-03-11  9:56 Colin Baxter
  2024-03-11 10:12 ` Colin Baxter
  2024-03-11 11:17 ` Christian Moe
  0 siblings, 2 replies; 5+ messages in thread
From: Colin Baxter @ 2024-03-11  9:56 UTC (permalink / raw)
  To: emacs-orgmode


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.



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

* Re: Footnotes on line and not raised
  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 11:17 ` Christian Moe
  1 sibling, 1 reply; 5+ messages in thread
From: Colin Baxter @ 2024-03-11 10:12 UTC (permalink / raw)
  To: emacs-orgmode


Perhaps it's not possible because I see that .footref in css support is
always <sup>.



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

* Re: Footnotes on line and not raised
  2024-03-11 10:12 ` Colin Baxter
@ 2024-03-11 11:03   ` Juan Manuel Macías
  2024-03-11 15:33     ` Colin Baxter
  0 siblings, 1 reply; 5+ messages in thread
From: Juan Manuel Macías @ 2024-03-11 11:03 UTC (permalink / raw)
  To: Colin Baxter; +Cc: emacs-orgmode

Colin Baxter writes:

> Perhaps it's not possible because I see that .footref in css support is
> always <sup>.

You can modify <sup> a little so that it does not alter the paragraph
line spacing so much. In this example, with a value of 0em, it is
positioned on the baseline:

#+HTML_HEAD: <style> sup {vertical-align: baseline;position: relative;bottom: 0em;} </style>

Another slightly dirtier way is with an export filter in your document.
The sub tag is removed and the reference number is enclosed in square
brackets, separated by a space from the previous word:

#+BIND: org-export-filter-footnote-reference-functions (footnote-sup-filter)
#+begin_src emacs-lisp :exports results :results none
  (defun footnote-sup-filter (text backend info)
    (when (org-export-derived-backend-p backend 'html)
(replace-regexp-in-string "<a" " <a"
(replace-regexp-in-string "\\([[:digit:]]+\\)\\(</a\\)" "[\\1]\\2"
      (replace-regexp-in-string "</?sup>" "" text)))))
#+end_src

screenshot:

https://i.ibb.co/CBRnfXG/pantallazo-79248380551244229p8.png

Best regards,

Juan Manuel 

-- 
Juan Manuel Macías -- Composición tipográfica, tratamiento de datos, diseño editorial y ortotipografía



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

* Re: Footnotes on line and not raised
  2024-03-11  9:56 Footnotes on line and not raised Colin Baxter
  2024-03-11 10:12 ` Colin Baxter
@ 2024-03-11 11:17 ` Christian Moe
  1 sibling, 0 replies; 5+ messages in thread
From: Christian Moe @ 2024-03-11 11:17 UTC (permalink / raw)
  To: m43cap; +Cc: emacs-orgmode

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.


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

* Re: Footnotes on line and not raised
  2024-03-11 11:03   ` Juan Manuel Macías
@ 2024-03-11 15:33     ` Colin Baxter
  0 siblings, 0 replies; 5+ messages in thread
From: Colin Baxter @ 2024-03-11 15:33 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: emacs-orgmode, mail


Dear Christian and Juan,

Thank you very much for your contributions. These are great and exactly
what I want. I'll probably go with an export filter. 

Thank you

Best Wishes,

Colin Baxter.


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

end of thread, other threads:[~2024-03-11 15:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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).