Is it possible to create a footnote within a styled paragraph without having the footnote styled the same way?

In a blank document, type \strong(ENTER)This text is strong\footnote(ENTER)But so is this footnote…

Is there a way to have the footnote not take on the styling of the environment it’s enclosed in? It seems like it may be, as typing \really-huge(ENTER)This text is really huge\footnote(ENTER)But this footnote isn’t works as expected.

I used strong as an example, but what I really care about is having footnotes within \samp. I’d prefer not to have to manually end the samp environment to insert a footnote, then create a new samp environment immediately after.

Thanks.


<TeXmacs|2.1.4>

<style|generic>

<\body>
  <strong|This text is strong<\footnote>
    But this footnote is too<text-dots>
  </footnote>>

  <really-huge|This text is really huge<\footnote>
    But this footnote isn't.
  </footnote>>
</body>

<\initial>
  <\collection>
    <associate|page-medium|paper>
  </collection>
</initial>

<\references>
  <\collection>
    <associate|footnote-1|<tuple|1|1|..\\AppData\\Roaming\\TeXmacs\\texts\\scratch\\no_name_4.tm>>
    <associate|footnote-2|<tuple|2|?|..\\AppData\\Roaming\\TeXmacs\\texts\\scratch\\no_name_4.tm>>
    <associate|footnr-1|<tuple|1|1|..\\AppData\\Roaming\\TeXmacs\\texts\\scratch\\no_name_4.tm>>
    <associate|footnr-2|<tuple|2|?|..\\AppData\\Roaming\\TeXmacs\\texts\\scratch\\no_name_4.tm>>
  </collection>
</references>

Hi @bodertz and welcome to the forum.

I only know how to do it for one environment; I do not know a way that would work for any environment, although it feels like there may be a general way. One has to add to the definition of the footnote macro the environment variables that have been changed by the (say) samp environment, giving them their default values for your document.

<assign|render-footnote*|<macro|sym|nr|body|<\float|footnote|>
  <smaller|<with|font-family|rm|par-mode|justify|par-left|0cm|par-right|0cm|font-shape|right|dummy|<value|page-fnote-sep>|dummy|<value|page-fnote-barlen>|<surround|<locus|<id|<hard-id|<arg|body>>>|<link|hyperlink|<id|<hard-id|<arg|body>>>|<url|<merge|#footnr-|<arg|nr>>>>|<arg|sym>><footnote-sep>|<set-binding|<merge|footnote-|<arg|nr>>|<value|the-label>|body><right-flush>|<arg|body>>>>
</float>>>

where I have added font-family|rm to the with that encloses the footnote macros.

Maybe someone else will be able to answer more comprehensively.

Thank you for answering this, as well as for answering others’ questions.

Copying over the modified render-footnote* into the document preamble seems to have worked. And I’ve managed to do something similar for marginal-note by making a new macro, mn, which has with|font-family|ss|language|english. The language|english part is to get rid of the language|verbatim set if you use verbatim (instead of samp, which I was trying before). So I think this is a workable workaround.

It does seem to me, though, that footnotes should not take their styling from the environment they’re in in the way that they do. Would some function that resets a number of style variables to whatever they were set to in the main document be technically infeasible? Something like ‘<with-document-base-styles|…’?

I hope it is feasible, but I do not know how. In this forum there are a few people who know TeXmacs’ code better than I do, maybe they can answer. If you do not get any other answer here you might also write in the mailing list where the group of people that read only partially coincides with the group of people that read this forum.

It might make sense also to submit the current behaviour of footnotes as a bug in the bug tracker (I would like to hear some other opinion on this).