Help for styling sphinx latex, using memoir and decorate lists

281 views
Skip to first unread message

cognacc

unread,
Jan 25, 2011, 4:42:13 PM1/25/11
to sphinx-dev
Hi

Hi i sent ths earlierand got a message that i should get a mail within
24 hours. (approval?). But i havent seen anything so now i send it
again.


I'm writing my exam project in restructuredText and Sphinx.

ps. thank you for these nice utilities (reST, Sphinx,
rst2pdf(R.Alsina)).

These utilities saves my time, in that i only need to write laTeX,
When i need something fancier or special.

Also it has increased my documentation speed/production x5 or
something like that.

But i have trouble styling laTeX, im ok with stylesheets for html.
I also made some styles changes for rst2pdf.

But after i while i found out that i needed to use the LaTeX output
for
designing the documentation content presentation i want.

I did make a design in css. that is the closest to what i want.

This is my needs
----------------

1. i want chapter styles in different shades of blue and grey
1.1 Chapter/Parts should be on darkgrey background with black
border
Rounded corners. lightgrey text
1.2 section/subsection/subsubsections is in
darkblue -> lightblue -> verylight grey(greyblueish)
border get thinner and thinner, letter white, except
subsub. where its black.

2. Background colour should be a light sandcolour(like paper not
completely
bleached),(but not in print)?

3. i want to have lists surrounded by a kind of box with thin border
or a line along the list length for visual guidance
http://en.wikibooks.org/wiki/LaTeX/Colors#Adding_the_color_package
look at the greenish sidebar table of contents, something like
that
surrounding my lists

I looked at the latex memoir class, and want something like
http://www.tex.ac.uk/tex-archive/info/MemoirChapStyles/MemoirChapStyles.pdf
see page 37.

Is this possible, are there anybody that have some styles they use.
That i can hack, instead of starting from zero.

Trying to use memoir gives me this error (offcourse!).
! LaTeX Error: Two \documentclass or \documentstyle commands.

A latex knowlegdeable guy helped me make a list with a sidebar,
but i don't knowhow to make use of if via sphinx. (make a directive).

here is his code:
--------
\documentclass{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lmodern,lipsum}

\usepackage{framed,xcolor} % needed for the new environments

\definecolor{linecolor}{rgb}{.64,.79,.62}

\newenvironment{fancyenv}{%
\def\FrameCommand{\textcolor{linecolor}{\vrule width 4pt} \hspace{4pt}}
%
\MakeFramed{\advance\hsize-\width \FrameRestore}}
{\endMakeFramed}

\newenvironment{fancylist}{%
\def\FrameCommand{\textcolor{linecolor}{\vrule width 4pt}
\hspace{-8pt}}%
\MakeFramed{\advance\hsize-\width \FrameRestore}%
\begin{itemize}}
{\end{itemize}\endMakeFramed}

\begin{document}
\lipsum[1]
\begin{itemize}
\item Test
\item Wup wup
\end{itemize}

\begin{fancyenv}
\noindent Text
\begin{itemize}
\item Test
\item Wup wup
\end{itemize}
\end{fancyenv}
\lipsum[2]

\begin{fancylist}
\item test
\item double cool
\end{fancylist}
\end{document}
-------

Can i get help on how to use that?
Maybe without the memoir calss if that not doable?!


Pheew that was quite a lot, hope it's ok.

regards Michael

Guenter Milde

unread,
Feb 1, 2011, 3:36:12 AM2/1/11
to sphin...@googlegroups.com
On 2011-01-25, cognacc wrote:

...

> Trying to use memoir gives me this error (offcourse!).
> ! LaTeX Error: Two \documentclass or \documentstyle commands.

You need to change the documentclass that is used by Sphinx to "memoir".
in the projects config file.

> A latex knowlegdeable guy helped me make a list with a sidebar,
> but i don't knowhow to make use of if via sphinx. (make a directive).

> here is his code:
> --------

These lines should not be needed in your custom preamble (configure
Sphinx to use the document class and packages instead).

> \documentclass{memoir}
> \usepackage[T1]{fontenc}
> \usepackage[utf8]{inputenc}
> \usepackage[english]{babel}
> \usepackage{lmodern,lipsum}

> \usepackage{framed,xcolor} % needed for the new environments

Insert as custom preamble code from here on,

> \definecolor{linecolor}{rgb}{.64,.79,.62}

> \newenvironment{fancyenv}{%

...


You might also need to re-define some commands to use your custom versions.

All untested, but it might get you started...

Günter

cognacc

unread,
Feb 2, 2011, 8:23:14 PM2/2/11
to sphinx-dev


On Feb 1, 9:36 am, Guenter Milde <mi...@users.berlios.de> wrote:
> On 2011-01-25, cognacc wrote:
> > Trying to use memoir gives me this error (offcourse!).
> > ! LaTeX Error: Two \documentclass or \documentstyle commands.

> You need to change the documentclass that is used by Sphinx to "memoir".
> in the projects config file.

You mean the conf.py?
It seems the string sphinx is prepended to what i put in late
documents.

---
latex_documents = [
('index', 'graphexplorertutor.tex', u'Graph explorer \\& tutor
Documentation : IMM-B.Eng-2010-50',
u'Michael Kell Jensen', 'manual'),
]
---

so if i change 'manual' to 'memoir' if
looks for sphinxmemoir(.cls)

Easily solved, i copy the memoir class from my tex distribution to a
file named sphinxmemoir.cls.
But maybe i should move sphinxmemoir.cls to my static files under my
sphinx root?

> > A latex knowlegdeable guy helped me make a list with a sidebar,
> > but i don't knowhow to make use of if via sphinx. (make a directive).
> > here is his code:
> > --------
>
> These lines should not be needed in your custom preamble (configure
> Sphinx to use the document class and packages instead).
>
> > \documentclass{memoir}
> > \usepackage[T1]{fontenc}
> > \usepackage[utf8]{inputenc}
> > \usepackage[english]{babel}
> > \usepackage{lmodern,lipsum}
> > \usepackage{framed,xcolor} % needed for the new environments
>
> Insert as custom preamble code from here on,

Thanks.

> > \definecolor{linecolor}{rgb}{.64,.79,.62}
> > \newenvironment{fancyenv}{%
>
> ...
>
> You might also need to re-define some commands to use your custom versions.

Could you give me a pointer to documentation and examples.
Where do i redefine commands, is that in the sphinx.sty or.

> All untested, but it might get you started...

thanks.

Ps. is there some documentation on what the tabulary.sty does?
From my small experimentations it seems that thats the one that will
trouble me most.

Pps. If i can make some progress and make a good result, would it not
be a good thing
to have a sphinxmemoir.cls class inegrated in the sphinx distribution?


> Günter

Guenter Milde

unread,
Feb 3, 2011, 2:16:32 AM2/3/11
to sphin...@googlegroups.com
On 2011-02-03, cognacc wrote:
> On Feb 1, 9:36 am, Guenter Milde <mi...@users.berlios.de> wrote:
>> On 2011-01-25, cognacc wrote:

>> > Trying to use memoir gives me this error (offcourse!).
>> > ! LaTeX Error: Two \documentclass or \documentstyle commands.

>> You need to change the documentclass that is used by Sphinx to "memoir".
>> in the projects config file.

> You mean the conf.py?

Yes.

> It seems the string sphinx is prepended to what i put in latex
> documents.

Strange.

> ---
> latex_documents = [
> ('index', 'graphexplorertutor.tex', u'Graph explorer \\& tutor
> Documentation : IMM-B.Eng-2010-50',
> u'Michael Kell Jensen', 'manual'),
> ]
> ---

> so if i change 'manual' to 'memoir' it
> looks for sphinxmemoir(.cls)

> Easily solved, i copy the memoir class from my tex distribution to a
> file named sphinxmemoir.cls.
> But maybe i should move sphinxmemoir.cls to my static files under my
> sphinx root?

The documentation
(http://sphinx.pocoo.org/config.html#confval-latex_documents) says:

documentclass:
Normally, one of 'manual' or 'howto' (provided by Sphinx). Other
document classes can be given, but they must include the “sphinx”
package in order to define Sphinx’ custom LaTeX commands. “howto”
documents will not get appendices. Also, howtos will have a simpler
title page.

I read this that you can change 'manal' to one of the common LaTeX
documentclasses (like 'memoir' or 'article') and it should use
memoir.cls or whatever.

But need to have a \usepackage{sphinx} in the LaTeX preamble ::

latex_elements['preamble'] = '\usepackage{sphinx}'

to load the sphinx package (file sphinx.sty) that defines Sphinx-specific
LaTeX commands.

Günter

cognacc

unread,
Feb 3, 2011, 4:27:39 AM2/3/11
to sphinx-dev
on Feb 3, 8:16 am, Guenter Milde <mi...@users.berlios.de> wrote:
> On 2011-02-03, cognacc wrote:
> > On Feb 1, 9:36 am, Guenter Milde <mi...@users.berlios.de> wrote:
> >> On 2011-01-25, cognacc wrote:
> >> > Trying to use memoir gives me this error (offcourse!).
> >> > ! LaTeX Error: Two \documentclass or \documentstyle commands.
> >> You need to change the documentclass that is used by Sphinx to "memoir".
> >> in the projects config file.
> > You mean the conf.py?
>
> Yes.
>
> > It seems the string sphinx is prepended to what i put in latex
> > documents.
>
> Strange.

memoir specified.

latex_documents = [
('index', 'graphexplorertutor.tex', u'Graph explorer \\& tutor
Documentation : IMM-B.Eng-2010-50',
u'Michael Kell Jensen', 'memoir'),
]

After moving a couple paths of sphinxmemoir.cls to
sphinxmemoir.cls.bac i get this.

! LaTeX Error: File `sphinxmemoir.cls' not found.

I think there was a "recent" change, because the name manual.cls was
considered too general?

> documentclass:
>   Normally, one of 'manual' or 'howto' (provided by Sphinx). Other
>   document classes can be given, but they must include the “sphinx”
>   package in order to define Sphinx’ custom LaTeX commands. “howto”
>   documents will not get appendices. Also, howtos will have a simpler
>   title page.
>
> I read this that you can change 'manal' to one of the common LaTeX
> documentclasses (like 'memoir' or 'article') and it should use
> memoir.cls or whatever.
>
> But need to have a \usepackage{sphinx} in the LaTeX preamble ::
>
>   latex_elements['preamble'] = '\usepackage{sphinx}'

it seems sphinx is automatically included if i read the code
correctly.
Looking in.

/usr/lib/python2.7/site-packages/Sphinx-1.0.7-py2.7.egg/sphinx/writers/
latex.py:
---
HEADER = r'''%% Generated by Sphinx.
\def\sphinxdocclass{%(docclass)s}
\documentclass[%(papersize)s,%(pointsize)s%(classoptions)s]{%
(wrapperclass)s}
%(inputenc)s
%(utf8extra)s
%(fontenc)s
%(babel)s
%(fontpkg)s
%(fncychap)s
%(longtable)s
\usepackage{sphinx}
%(preamble)s
---

mic
Reply all
Reply to author
Forward
0 new messages