R Bookdown - Customize width of TOC/Sidebar
Asked Answered
B

1

7

Although I can change the width and position of different elements in the body of an r bookdown doc by modifying the page wrapper in the .css, is there a way to change the width of the sidebar by modifying the styles sheet?

I'm not looking to change the font or color of the words in the TOC, just the width. Something like:

width: 50px; margin-right: 0;

I don't need a wide sidebar, but I do need more width in the body.

I already widened the inner body as much as possible, so all that is left is the sidebar.

Brendis answered 12/8, 2018 at 5:10 Comment(0)
R
5

In your _output.yml add the css filename

bookdown::gitbook:
  css: style.css

Create style.css to change the default 300px

.book .book-summary {
  width: 350px;
  position:absolute;
  top:0;
  left:-350px;
}

.book.with-summary .book-header.fixed {
    left: 350px;
}

.book.with-summary .book-body {
    left: 350px;
}
Rosabella answered 3/12, 2019 at 23:41 Comment(1)
It works whenever the sidebar is visible. But when I click on the toggle sidebar button to make disappear the menu, the sidebar does not close completely. 50px remain left from the sidebar.Villa

© 2022 - 2024 — McMap. All rights reserved.