omikhleia / resilient.sile Goto Github PK
View Code? Open in Web Editor NEWAdvanced book classes and packages for the SILE typesetting system
License: MIT License
Advanced book classes and packages for the SILE typesetting system
License: MIT License
When I try to use resilient default settings, I got a wrong section name or section number in header. Please look at my minimal example (PDF file attached):
\begin[papersize=a5,class=resilient.book]{document}
\use[module=packages.lorem]
\chapter{Lorem ipsum 1.}
\lorem
\section{Lorem ipsum 1.1.}
\lorem
\subsection{Lorem ipsum 1.1.1.}
\lorem
\subsection{Lorem ipsum 1.1.2.}
\lorem[words=900]
\end{document}
On PDF page number 5 the header consists of second subsection number (1.1.2), but first section name. I don't know, whether it should consist section data (that's what I would assume) or subsection data, but currently it's mixed.
PS: On page number 4 header consists of chapter name, but without chapter number. Is this intended?
Ah! At least an interesting case for misaligned folio numbers across pages, when one sets them to be "old style" numbers.
In some ways a friend to sile-typesetter/sile#1430 (with default TeX-like typesetting rules).
Expectations: Aligned on actual baseline, regarding of "ascenders" and "descenders"...
Possible workaround: use a "strut" to align contents.
This would work. Still, this sounds more like a workaround than a way to properly set the "first" baseline in a frame.
Funny, no one tried these things in so many years. Heh. It tells something, doesn't it? 🙄
The resilient manual still has several files in SIL (typically, the class chapter)
It also mentions SIL a lot (e.g. in package descriptions).
For people who use Markdown or Djot, the usage is not always straightforward. I am sure we can do better.
See discussion #37
(WIP draft description - Check PR #51 for the actual implementation)
Say you have a collection of individual chapters (or any other division scheme) in Djot, Markdown or even SIL, and you want to gather these into a book, with all bells and whistles.
Seasoned users experience with the SILE packages and the SIL language surely know how to write a "wrapper" document in that language, invoking all required commands and including their content files. All the low-level constructs are there to do so. There's some things however that they will end up doing all the time, repetitively: at the very least, pick up a font, set a main language, load fairly standard packages, set PDF metadata... Moreover, if your content, or most of it, was authored in Djot or Markdown1, it feels quite cumbersome to have to write such a wrapper in SIL syntax, doesn't it ?
The resilient collection introduces a new type of document, a "master document" format which aims at simplifying and streamlining the process, abstracting and taking care of most of the usual needs. Master documents usually have the .silm
extension and can be processed as shown below.
sile -u inputters.silm mybook.silm
The format consists in a simple description of the book properties and contents, expressed in YAML, a lightweight human-readable data-representation language.
masterfile: 0.0
metadata:
# title, authors, subject and keywords will be used as PDF metadata.
# title may be used in running headers (depending on the class)
# all fields may eventually be used in the cover or other places,
# e.g. maybe as Djot symbol variables for templating?
title: Les Chats d’Ulthar
subtitle: Une "nouvelle" fantastique
subject: Nouvelle
keywords:
- Cats
- Tale
authors: H. P. Lovecraft
translators: Wikisource
publisher: Silex Éditions
pubdate: 2023-07-14
ISBN: 978-2-490-87500-0
url: https://github.com/Omikhleia/resilient.sile
copyright: © 2023, Silex Éditions pour la présente édition.
legal: |
Ce texte est dans le domaine public.
# Or any other "legalese" text you want to add, beside the copyright.
font:
# main (default) font
# Note: if we were sure to use a resilient class, we could have used a style
# definition, but we may want to be able to support other classes...
family: [EB Garamond, Libertinus Serif] # string or list, in which case the other fonts are declared as font fallbacks
size: 12pt
language: fr # main default language
sile:
# when processing the master file with SILE...
options:
# These are class options, so can be overridden via the CLI
# class: resilient.book # optional (default)
papersize: 6in x 9in
layout: ateliers demiluxe
resolution: 300
settings:
# (optional) global settings we may want to set
textsubsuper.fake: false
# typesetter.italicCorrection: true
packages:
# (optional) list of extra packages to load if needed (e.g. not loaded by the class, etc.)
- dropcaps
- couyards
content:
# Ordered list of other content files to include in markdown or djot (or sil).
- chats_d_ulthar.dj
- memoire.dj
Several Markdown processors, such as the Pandoc converter and some static website generators, support metadata blocks as a special construct in Markdown files, with a varying syntax and often ad hoc conventions. We are trying, here, to be more general and consistent, regardless of the input format. ↩
When I use grid layout and set grid spacing slightly larger than font size, skip between part number and name is missing:
Without grid layout (or spacing = 11pt):
Please look at my minimal example (output PDF file attached):
\begin[papersize=a5,class=resilient.book]{document}
\use[module=packages.lorem]
\use[module=packages.grid]
\grid[spacing=13pt]
\font[family=Libertinus Serif,size=11pt]
\part{Name Of Part One}
\chapter{Chapter One}
\lorem
\end{document}
Minimal set = problems listed in Freely-Given-org/BibleTypesetter#3
The skips before and after the poetry environment were still hard-coded from the initial implementation.
Use paragraph styles.
Hi there,
Last night, I updated resilient.sile and this happened, this did not happen with earlier versions.
I still can't where the problem comes from.
My folio style is as follows:
folio-even:
inherit: "folio-base"
origin: "resilient.book"
style:
font:
size: "0.80em"
# paragraph:
# align: "left"
folio-odd:
inherit: "folio-base"
origin: "resilient.book"
style:
font:
size: "0.80em"
paragraph:
align: "right"
Since the removal of the poorly coded multilevel counter overrides in 5d93e9f (now that these were merged in SILE), we have lost the ability to remove the leading zeroes in section and other sub-levels where the previous levels are unnumbered.
Analysis:
Oops, the noleadingzero
option to counters used in resilient classes becames noleadinzeros
in the SILE PR (prolly I overlooked that when I back-ported it from another branch).
The title says it all.
This went in SILE 0.14.8:
sile-typesetter/sile@1ac793f
Since the (SILE) lists packages was based on (omikhleia's enumitem >) resilient.lists, perhaps it applies here too.
(Moved from ptable.sile)
Since Aug. 2022 (or earlier, can't remember and lazy to check), the framebox package has an experimental and undocumented \roughunder
command using a sketchy line(s) for a replacement of the "underline" command. As noted in-code:
This would need to be re-implemented and checked after multiline effects (e.g. multiline links and underline) are possibly added to the typesetter.
Such "liners" spanning multiple lines are making it in SILE develop
branch for 0.15 and likewise in sile-x, which would allow to better implement this...
The command doesn't really belong to framebox, and should perhaps be moved to a dedicated package ("roughrules?")
There we could have:
I can't find the source file that calls the OCR B font. I have OCR B Std, but not OCR B.
Oops.
An unnoticed side effect of having switched from SILE's ragged environments to our own via paragraph styling in 3a16ef1
The former don't support nesting, but cancel parindent; the latter support (r/l skip) nesting but doesn't touch the parindent (by design, on purpose!)... And see details further below.
Workaround:
Override the default style in the document's style file:
folio-even:
inherit: "folio-base"
origin: "resilient.book"
style:
paragraph:
align: "left"
before:
indent: false
folio-odd:
inherit: "folio-base"
origin: "resilient.book"
style:
paragraph:
align: "right"
before:
indent: false
Note
SILE.call("noindent")
, but paragraph styles re-enable it currently (= the default is true)There might be more than meets the eye, here (wrong default?), to check.
EDIT: And we also have to check how SILE issue 1699 gets addressed, because we are also in that situation (temporary environment), with parindent scoping issues.
I'm trying to package resilient.sile on nixpkgs. To make sure that everything works correctly, I tried rendering the manual, but got the error in the title.
I will link the repository with the Nix flake so it is easier to reproduce, once I publish it.
SILE v0.14.17 (LuaJIT 2.1.1693350652)
[21] [22] [23]
! Invalid color specification at:
./packages/resilient/sectioning/init.lua:250: in \internal:open-spread[parity="odd"] after 225: in \supereject
./packages/resilient/sectioning/init.lua:84: in \open-on-odd-page
examples/manual-layouts/layouts.sil:77:1: in \sectioning[style="sectioning-chapter"]
examples/manual-layouts/layouts.sil:77:1: in \chapter[style="sectioning-chapter"]
examples/manual-layouts/layouts.sil: in <snippet>:
[[\begin{document}\chapter{Choosing a page layout}\section{The layout class option}Paper sizes fo]]
examples/manual-layouts/layouts.sil: in <snippet>:
[[\begin{document}\chapter{Choosing a page layout}\section{The layout class option}Paper sizes fo]]
examples/sile-resilient-manual.silm:0:0: in \include[["meta:author"]="Didier Willis",["meta:authors"]="Didier Willis",["meta:copyright"]="© 2021–2024, Didier Willis.",["meta:keywords"]="SILE, typesetting, book",["meta:legal"]=[[This material may be distributed only subject to the terms and conditions
set forth in the Creative Commons Attribution, Share-Alike License,
version 2.0 (http://creativecommons.org/licenses/by-sa/2.0/).
]],["meta:pubdate"]="2024-03-17",["meta:pubdate-day"]="17",["meta:pubdate-month"]="3",["meta:pubdate-year"]="2024",["meta:publisher"]="Omikhleia",["meta:subject"]="User manual for the resilient.sile module",["meta:subtitle"]="User Guide",["meta:title"]="The re·sil·ient collection of classes & packages for SILE",["meta:url"]="https://github.com/Omikhleia/resilient.sile",shift_headings=0,src="manual-layouts/layouts.sil"]
examples/sile-resilient-manual.silm: in <snippet>:
[[masterfile: 1.0metadata: title: The re·sil·ient collection of classes & packages for SILE sub]]
stack traceback:
[C]: in function 'error'
...99j49wx1q0fwk-sile-0.14.17/share/sile/core/utilities.lua:42: in function 'error'
...are/lua/5.1/sile/packages/framebox/graphics/renderer.lua:46: in function 'makeColorHelper'
...are/lua/5.1/sile/packages/framebox/graphics/renderer.lua:270: in function 'rectangle'
./resilient/layouts/base.lua:137: in function 'buildFrameRect'
./resilient/layouts/base.lua:195: in function 'outputYourself'
...j49wx1q0fwk-sile-0.14.17/share/sile/core/nodefactory.lua:557: in function 'outputYourself'
...350652-env/share/lua/5.1/sile/silex/typesetters/base.lua:953: in function 'outputLinesToPage'
...350652-env/share/lua/5.1/sile/silex/typesetters/base.lua:762: in function 'buildPage'
...350652-env/share/lua/5.1/sile/silex/typesetters/base.lua:973: in function 'leaveHmode'
...
...h79qh99j49wx1q0fwk-sile-0.14.17/share/sile/core/sile.lua:385: in function <...h79qh99j49wx1q0fwk-sile-0.14.17/share/sile/core/sile.lua:350>
...h79qh99j49wx1q0fwk-sile-0.14.17/share/sile/core/sile.lua:444: in function 'call'
...h79qh99j49wx1q0fwk-sile-0.14.17/share/sile/core/sile.lua:279: in function 'process'
...h79qh99j49wx1q0fwk-sile-0.14.17/share/sile/core/sile.lua:345: in function 'processString'
...h79qh99j49wx1q0fwk-sile-0.14.17/share/sile/core/sile.lua:385: in function 'fun'
...p1-luajit-2.1.1693350652-env/share/lua/5.1/pl/tablex.lua:351: in function 'imap'
...e/4ms3s9jcizknrmh79qh99j49wx1q0fwk-sile-0.14.17/bin/sile:56: in function <...e/4ms3s9jcizknrmh79qh99j49wx1q0fwk-sile-0.14.17/bin/sile:55>
[C]: in function 'xpcall'
...e/4ms3s9jcizknrmh79qh99j49wx1q0fwk-sile-0.14.17/bin/sile:55: in main chunk
[C]: at 0x004062d0
error summary:
Processing at: ./packages/resilient/sectioning/init.lua:250: in \internal:open-spread[parity="odd"] after 225: in \supereject
Using code at: ...are/lua/5.1/sile/packages/framebox/graphics/renderer.lua:46:
Tentatively planned Oct. 7, 2023
Decisions
Checklist:
I wanted to see how this package could be extended for easy localization. What I did for right now is I just created a bunch of hacks for digit mapping to test and see whether it works. If you look at this, this, and this, what I've done is I've basically added an extra option to the \begin{document}
declaration called language
, and that basically determines how the section numbers/digits are localized.
But I'm trying to wrap my head around how I can make it easier to localize further. Any thoughts?
The following experiment uses SILE's standard book class (0.14.8), showing
The reason for using the standard book class is shows a few things we also have in resilient.book, but in a simpler way (without the styling stuff on top of that).
See exp. the 2 skips between a chapter and a section = bottom skip from chapter + top skip from section.
In resilient moreover, another similar case occurs with nested blockquotes, e.g.
Here with 2 skips at the bottom of the nested quotes (= bottom skip from inner quote + bottom skip from outer quote).
It doesn't really meet my expectations in terms of proper styling -- It would be quite doable to mark skips and detect consecutive top/bottom skips of a certain type to only use one of those where needed...
The idea is a bit similar (but not completely) to the following possibility in LibreOffice
If we don't do anything (as currently), besides the 2 skips when a chapter is immediately followed by a section header (vs. 1 skip when a chapter is immediately followed by a text paragraph - notwithstanding a potential parskip), then it seems to me there might also be an additional issue: before a section header, there's usually a "goodbreak", which may lower the penalty of page breaking here! This is obviously ok when text precedes the section header, but if the previous content was another section header (= typically, a section title immediately followed by a subsection header), this might contradict the "novbreak" expected there = resulting in a potential page break between the two headers, which wouldn't look good IMHO (I am not fully sure how the pagebuilder honors consecutive penalties, but it seems to me it will occur this way!)
There's some head-scratching topic here, how to both meet user expectations in terms of skips, and to be safe with page breaks.
From discussion Omikhleia/markdown.sile#34 (reply in thread)
There are two different ways at looking at this topic:
numbering=false
in SIL or .unnumbered
in Markdown (Omikhleia/markdown.sile#51)Regarding the second point, in the above-mentioned discussion, I wrote:
styles currently don't address it
But it's kind of an overlooked topic or a loophole in the logic:
resilient.sile/packages/resilient/sectioning/init.lua
Lines 118 to 128 in d25cc41
That "else" seems bad :)
When the sectioning style has no numberstyle.main
entry, we issue a warning, and still display an "unstyled" number. Perhaps we should just accept it and not show anything there. It would need proper documentation --
With (default) style such as:
figure-caption:
...
sectioning:
counter:
id: "figures"
level: 1
numberstyle:
main: "figure-caption-main-number"
reference: "figure-caption-ref-number"
...
One gets the number displayed with the said figure-caption-main-number
numbering style....
But if the main
field is removed from the definition, rather than warn and do something, we could just skip the number output...
We need a resilient.indexer package for index entries.
(Opened here so as to close a checkbox in Omikhleia/omikhleia-sile-packages#13 since it won't happen there)
When SILE 1709 lands (like 0.14.9), we could use the new urlstyle hook from the url package to implement a resilient style for it (= similar to what we do with foliostyle) -- and remove the hack (killing the code command) used in the Lefevre example.
Creating the issue now, not to forget it.
This got mentioned in #11 and Omikhleia/markdown.sile#34 (comment), and it is one of the major uncompleted task from the old repository Omikhleia/omikhleia-sile-packages#13 (first bullet), it might be the good time for moving on, regarding the "version 2" Style Paradigm topic.
To summarize the things at stakes
So big breaking changes were considered, and some work even started privately in that direction.
Without committing on a deadline, I'll open a PR referring to this issue, and push there the design documents, (part of) the current code changes (some were made in a private repository for my next book -- I'll check how to cherry-pick them, or just copy the relevant code if it's too entangled).
These changes encompass a lot of breaking changes regarding the styling API inherited from the old Omikhleia classes. (Die, \style:define
and SIL-like friends, die!). When it's there, follow the PR and don't hesitate commenting it ;-)
With all the ongoing development of the support packages at the same time (tables, cross-refs, captioned figures, poetry...), it left little time to make sound decisions regarding the internals of the styling stuff. Then came some major work on the Markdown package collection, the switch to SILE 0.14... And a new book project.... ↩
in a technical book, the odd header is the section title (but could also user lower levels), and the even header is the chapter title.
In a novel, the odd header is the chapter title, and the even header is the book title.
Our current sectioning hooks do not allow easily configuring this layout difference (other than overriding their implementation, but there are other places when we'd need to know the layout - e.g. in master documents to know what to do with the book title)
Trying to build the documentation in ./examples with the command
sile -u inputters.silm mybook.silm
using SILE v0.14.17 (Lua 5.3) in Ubuntu 22.04, I`ve got the following error:
=========================================================================
! Could not find file at
! Unexpected Lua error
error summary:
Processing at:
Using code at: /home/pablo/.local/share/sile/outputters/libtexpdf.lua:31: attempt to index a nil value (field 'paperSize')
This is caused by the line
local w, h = SILE.documentState.paperSize[1], SILE.documentState.paperSize[2]
A bit messy and poorly documented:
resolution
class option, undocumented (well, actually just mentioned in passing -- i.e. in a footnote -- in the documentation of the embedders package, which is the only one to use it at this point...)There's probably ways to better document and address the need!
See discussion #55
As noted there, overriding \code
is easy.
The verbatim
environment is less obvious due to the way it uses its hook -- but looking at the original implementation, it does not make sense to me (a null baselineskip, really? Etc.) so I am implementing a full resilient-replacement for it.
The doc says:
In passing, the
none
layout uses margins of 1 inch on all sides. It just exists because it’s the base component for other layouts.
Er... 1 inch? Nope...
function layout:_init (_)
self.inner = "width(page)/6"
self.outer = "width(page)/6"
self.head = "height(page)/6"
self.foot = "height(page)/6"
self.offset = "0"
end
This said, no idea what's best here, what the doc states or what the code does. And I can't remember (nor find in the history) how I arrived to that discrepancy (... 1/6th has advantages too)
After #12, I also have plans to revisit the page layout mechanism introduced in resilient to make it more general (e.g. currently it uses hard-coded strings such as ateliers:2
, division:8
etc., but we could make it more general, with more options---a better positioning of folio and header frames being one of the issue at stakes).
Tentatively planned for 2.0 too, and we'll see how it can fit in the schedule.
As in the middle example... (Screenshot from a Lulu.com article).
But
It could be hard-coded to some extent, but to be checked how we can generalize the idea within our existing styling paradigm and layout concept ^^
Now that SILE 0.15 will have "liners", i.e. the ability for underlines and struck out content to span multiple lines; and that sile-x will have compatibility layer too, we should consider adding support for these in the styling paradigm.
Resilient.book 2.0:
If an essay never runs \odd-running-header
-- I failed to notice it earlier because I usually have the book name here -- then on the first even page after a chapter title, we won't get the chapter title.
To investigate further, but this might be due to the header being fully bypassed (and thus not clearing the status set by \noheaderthispage
)?
In conjunction with Omikhleia/markdown.sile#99
Rationale:
In some books, I'd need to be able to decide whether definition terms should be in boldface or not.
We probably need some variants (as for bullet/enum lists) as a document may need different strategies for different types of definition list, rather than a single global style.
But do we need a new style concept ("linked styles") to acknowledge a consistent choice between the term styling and the definition styling?
Split from discussion in #21 (comment)
Can something like this be implemented:
figure-caption-main-number:
inherit: "figure-caption-base-number"
style:
...
numbering:
visible: true|false
...
Check the whole discussion on the referred issue.
1d2e34b sounded so right at code re-reading that I fixed it directly on main without PR.
It leads to an issue in the Markdown and Djot manual, or rather a question:
What should the following do (here in Markdown)?
::: {custom-style=raggedright}
> Some
> quote
:::
And we'd possibly need to revert the change - currently it breaks there:
As the title says ;-) We'd need these at some point.
EDIT. (Sept. 5, 2023) "title page" is a slightly different topic obeying different rules, to split from front/back matters (which are actual content).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.