Replies: 9 comments 6 replies
-
|
If you want to fully customize the appearance of a particular element in a Quarto document, the standard way to go is to write a Pandoc filter that finds the node and re-emits it in the desired way. In your case, you'd be looking for a See https://quarto.org/docs/prerelease/1.4/lua_changes.html for more details. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you. I'll have a go --- but can I just check? Do you mean I should create a new filter, say (assuming I figure out how to add the bits I need) and then call it as in my Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
Ah --- OK. I'll have a go. I still haven't got my head around Thank you! |
Beta Was this translation helpful? Give feedback.
-
|
Sorry to be thick... But isn't this the actual relevant page? I had a quick go, but I didn't seem to be able to make it work fully, though... |
Beta Was this translation helpful? Give feedback.
-
|
You're right, of course... Just that it may be easier to fiddle by creating a new/custom float, I guess... I'll keep looking... |
Beta Was this translation helpful? Give feedback.
-
|
Can I please come back to this? I think I found a way to make it work the way I like. The only thing I haven't figured out is how to redefine the behaviour of Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
Of course --- but the path of least resistance for me was simply to work on my fork of the main and the file to get the desired effect (bar the quirk above)... I do this because I want to rename the float as "Box" and to make sure that the placement is I know I can use custom crossrefs, like and this is even better as I have direct control over the Does this make sense? Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
Thank you, @cscheid --- fair enough... Though, for completeness, nothing got broken, I think... Everything compiles perfectly --- if I'm happy to have As for your suggestion, yes: I know that'd be the way to go without touching the core code --- I haven't got the time to get around the way the new filter should work and, like I said, this was a cheaper (though, admittedly, dirtier...) solution... |
Beta Was this translation helpful? Give feedback.
-
|
BTW I think I was making life much more complicated than I needed to... As it turns out, without any hack on the original and then add the following before the first call to Thanks for the help! :-) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
This is related to #5142, where I've left some comments (though it's a closed issue)... I think the main problem was that, by default, the
codelistingis set up to be placedh, which means some long code blocks get sent at the end of the document.I've done some more digging and I think that I found out that If I modify the
luafilters (where exactly these files are, I think, depends on the OS + the version of quarto... Say for v1.4.550 and under Linux, I think the relevant files are:/opt/quarto/share/filters/main.luaand/opt/quarto/share/filters/crossref/crossref.lua--- but other versions may vary...If I hard-wire the changes I want there, like changing
"\\@ifundefined{c@chapter}{\\newfloat{codelisting}{h}{lop}}{\\newfloat{codelisting}{h}{lop}[chapter]}\n" ..to"\\@ifundefined{c@chapter}{\\newfloat{codelisting}{H}{lop}}{\\newfloat{codelisting}{H}{lop}[chapter]}\n" ..in both files, I seem to sort the issue and thecodelistings are all placed where I want them.Also, I can make the caption refer to "Box" instead of "Listing" by changing
\floatname{codelisting}{" .. as_latex(title("lst", "Listing")) .. "}to"\\floatname{codelisting}{Box}\n". Here, I haven't figured out how to avoid hard-wiring the text I want... thought that I could modify another part of the filtersspecifically by modifying
ListingwithBoxin thenameand/orprefix, but this didn't seem to work... But I guess I'm not doing this right?I don't love to have to hard-wire things and overwrite the original filters, but I did try to add these changes to customised filters, which it hasn't worked, actually. I wonder whether there's a better way to deal with this, @dragonstyle @cscheid?
Beta Was this translation helpful? Give feedback.
All reactions