Closed sammerk closed 7 years ago
This is caused by https://github.com/rstudio/rmarkdown/blob/d31ec87679571a84092b5bec4f7de6f42511e9a4/inst/rmd/h/tocify-1.9.1/jquery.tocify.css#L28-L31
You can specify your custom CSS to override it, e.g.,
.tocify-header {
text-indent: initial;
}
http://rmarkdown.rstudio.com/html_document_format.html#custom_css
In the future you can try to ask questions on StackOverflow first, where you might be quicker responses. Thanks!
I don't like the way the text is indented in the table of contents. See the instructions below for how to change it.
@yihui I would like to ask if you might consider changing the defaults so the text is wrapped nicely for all of the headers.
First, add the following header to your .Rmd
file:
---
title: "Your Title"
author: "Your Name"
date: "`r Sys.Date()`"
output:
html_document:
css: style.css
toc: true
toc_float:
collapsed: false
smooth_scroll: false
---
In the same folder as your .Rmd
file, create a new file called style.css
with the following contents:
.tocify-subheader > .tocify-item {
text-indent: initial;
padding-left: 2em;
}
Finally, knit your document and you should have nicely indented headings in the table of contents.
I know this has been closed, but it would be nice to be able to apply this solution to sub-sub-header as well (and possible further down the toc hierarchy. Thanks! It would be great to have this built into the Rmarkdown toc functionality, to have some kind of padding/margin/wrapping option for the toc display.
It would be great to have this built into the Rmarkdown toc functionality, to have some kind of padding/margin/wrapping option for the toc display.
@jstover79 Can you open a new issue about this Feature request if non already exists ? Without it, it won't be in the backlog to even been consider because closed issue won't often be noticed.
Out of aesthetic reasons I would prefer the same indent in all lines of a level 1 heading entry in the floating toc (see screenshot). This was fixed for higher level headings already ...
Thank's Samuel