Repository navigation
How to adjust margins in book class #1601
|
I want to make a document with the section command, but I do not want the inner and outer margin margins to be different. Also, UI would like, in general, to adjust the margins. How do I do this? I wanted to ask this question in the mailing list mentioned in the readme, but Google said the group doesn't exist. |
Replies: 6 comments 1 reply
|
The short version is that what you are looking for is not labeled "margins" per se, the page layout is defined by frames. The book class defaults to a frame layout that isn't centered, and uses mirrored masters to flip flop which way it is offset. You need to define (or redefine) a frameset that is centered and disable mirrored masters. A longer answer will come when I'm not running out the door, but this is also a common thing that should be documented better. The book class defaulting to inner/outer offests makes sense for book, but sometimes people want to make use of other book features and print to un-bound formats where that one feature doesn't make sense. |
|
@PapistPenguin You want Better probably to copy the book class into your document project directory, and edit it. :-) |
|
Copying the book class is probably not the best way to go, adding a new class that uses book at it's parent then changes or extends only the things you want to be different is probably better. The other way to do this that is a bit less involved that writing a new class and (in my opinion) a bit prettier than including frametricks and doing this in your document) is to write a Lua package / script include that sets up your frames the same way the book class does, just redefine the masters. For an example of using |
|
What are the expectations for this old ticket to be closed. Seems to me the question was answered, and the SILE manual devotes some content to frames and page templates, which I found useful when writing several page layouts. |
|
Pulling together previous comments with modern SILE APIs, define a new class for your project like this. Write a Lua file called local book = require("classes.book")
local class = pl.class(book)
class._name = "mybook"
class.defaultFrameset = {
content = {
left = "8.3%pw",
right = "86%pw",
top = "11.6%ph",
bottom = "top(footnotes)",
},
folio = {
left = "left(content)",
right = "right(content)",
top = "bottom(footnotes)+3%ph",
bottom = "bottom(footnotes)+5%ph",
},
runningHead = {
left = "left(content)",
right = "right(content)",
top = "top(content)-8%ph",
bottom = "top(content)-3%ph",
},
footnotes = {
left = "left(content)",
right = "right(content)",
height = "0",
bottom = "83.3%ph",
},
}
function class:_init (options)
book._init(self, options)
end
return classNote that frameset is copied directly from SILE's book class, so adjust the values to suit your project. Now use Of course you can inline this in a document as well by including a Lua code block at the top of your file that retrieves the current class and changes the frame properties ond the default frameset, then re-initalizes the frameset on the current page. It can also be done with declarative markup defining your own frameset. There are documented examples of all this already. I think that covers the options, if there is anything further don't hesitate to ask. |
|
Just for cross-linking, as the question still pops up from time to time: #460 (comment) |
Pulling together previous comments with modern SILE APIs, define a new class for your project like this. Write a Lua file called
clasases/mybook.luawith contents like this: