I am using \'Read the Docs\' Sphinx theme for my documentation. In the original theme, given below
http://read-the-docs.readthedocs.org/en/latest/theme.html
html_theme = 'sphinx_rtd_theme'
html_style = 'css/my_theme.css'
@import url("theme.css");
.wy-nav-content {
max-width: 90%;
}
That will be 90% width of your monitor.
First of all I must say, that during my sphinx quickstart I chose the option of separate folder for my sources and for my build.
It's a 3 steps process:
Where?
conf.py
lives, (in my case source
), I created a folder for my custom static files (stylesheets, javascripts). I called it custom
.source/custom/css
.source/custom/css/my_theme.css
.Now we have to tell sphinx to spit this document inside build/_static/css
, the same directory where is the stylesheet included in the Read The Documents theme. We do that adding the following line to conf.py
:
html_static_path = ['custom'] # Directory for static files.
Done. Now, if we build, we will have the RTD styles (theme.css
), and our custom my_theme.css
in the same directory, build/_static/css
.
Now we are gonna tell sphinx to use our custom my_theme.css
, instead of the RTD one. We do that adding this line in conf.py
:
html_style = 'css/my_theme.css' # Choosing my custom theme.
In our custom stylesheet, the first line should import the styles of theme.css
with @import url("theme.css");
.
And we are ready to start overwriting styles.
source/_static/css/my_theme.css
.In your custom stylesheet, the first line should import the styles of theme.css
with @import url("theme.css");
.
This way, you don't have to worry about messing up the default styles, if your custom stylesheet doesn't work, delete and start again.
conf.py
:html_style = 'css/my_theme.css'
I would modify this in the css. You should search for the file theme.css (it is in the read-the-doc sources at "sphinx_rtd_theme/static/css/theme.css").
Make a copy of that file and put it in your sphinx _static dir. In that css file you can make all the layout changes that you need. (You might have to read a bit on css files if you have never worked with that.)
Hope this helps.