Thank you Kevin! Sorry for not beeing clear, but you answered my question anyway. Using the .. raw directive means that the latex stuff don't appear in html which I wanted it to do. I want to produce html and pdf from the exacr same source.
I will look at your answer in the other posting! Johan On Wed, Jan 26, 2011 at 2:10 PM, Kevin Dunn <kgd...@gmail.com> wrote: > On Wed, Jan 26, 2011 at 05:19, Johan Ekh <ekh.jo...@gmail.com> wrote: > >> Thanks Kevin, >> it works! >> > > Great. > > >> Would you also know if it is possible to use latex in general, i.e. >> without ".. math::"? > > > I'm not 100% clear about your question. You can always include LaTeX code > directly in your RST using the > > .. raw:: latex > > % your LaTeX/pstricks code here > > directive. But those sections won't appear in HTML, or other output > formats. If your concern however is that typing ``.. math::`` and > ``:math:`` is too much of an overhead, when compared to LaTeX's \[... \] and > $...$ for math heavy documents, then your should write a macro in your text > editor (e.g. Ctrl-M) to generate that RST code for you. > > The advantage of Sphinx is of course that you can generate great HTML, PDF > and other output formats. Using those math roles and directives is a small > price to pay to help the HTML generator, LaTeX generator, etc know what you > want to do. > > >> Can I use pstricks to generate my graphics? >> > > I will reply to your other posting separately. > > Hope that helps, > Kevin > > >> Best regards, >> Johan >> >> >> >> >> On Tue, Jan 25, 2011 at 4:09 PM, Kevin Dunn <kgd...@gmail.com> wrote: >> >>> On Tue, Jan 25, 2011 at 06:14, Johan Ekh <ekh.jo...@gmail.com> wrote: >>> > Hi, >>> > I'm trying to use latex packages in Sphinx but I can't get it to work. >>> > >>> > I've put the following in my conf.py >>> > >>> > latex_preamble =[ >>> > ('\\usepackage{amssymb}', >>> > '\\usepackage{amsmath}', >>> > '\\usepackage{amsxtra}', >>> > '\\usepackage{bm}'), >>> > ] >>> > >>> > and it works when I generate html (with pngmath) with "make html". >>> > >>> > However, when I use "make latexpdf" I get the error below. Does anyone >>> > know what I should do? >>> >>> Hi Johan, >>> >>> The ``latex_preamble`` has been deprecated - see here: >>> http://sphinx.pocoo.org/latest/config.html#confval-latex_preamble >>> >>> As recommended in the docs, you should rather use a ``latex_elements`` >>> dictionary. >>> >>> For example, my documentation uses this idea in ``conf.py`` >>> >>> _PREAMBLE = r""" >>> \usepackage{amsmath} >>> """ >>> latex_elements = { >>> 'preamble': _PREAMBLE, >>> # other settings go here >>> } >>> >>> Please try that and see if it works better. >>> >>> By the way, the sphinx.sty file imports "amsmath" already, so you can >>> leave that one out. >>> Kevin >>> >>> > Best regards, >>> > Johan >>> > >>> > >>> > >>> > sphinx-build -b latex -d build/doctrees source build/latex >>> > Running Sphinx v1.0.5 >>> > loading pickled environment... done >>> > building [latex]: all documents >>> > updating environment: 0 added, 0 changed, 0 removed >>> > looking for now-outdated files... none found >>> > processing cabletlk.tex... index intro tutorial userguide theory >>> modules >>> > changes todos >>> > resolving references... >>> > writing... done >>> > copying TeX support files... done >>> > build succeeded. >>> > Running LaTeX files through pdflatex... >>> > make -C build/latex all-pdf >>> > make[1]: Entering directory >>> > `/home/johan/Source/Python/swProjects/cableFatigue/doc/build/latex' >>> > pdflatex 'cabletlk.tex' >>> > This is pdfTeX, Version 3.141592-1.40.3 (Web2C 7.5.6) >>> > entering extended mode >>> > (./cabletlk.tex >>> > LaTeX2e <2005/12/01> >>> > Babel <v3.8h> and hyphenation patterns for english, usenglishmax, >>> dumylang, >>> > noh >>> > yphenation, arabic, basque, bulgarian, coptic, welsh, czech, slovak, >>> german, >>> > ng >>> > erman, danish, esperanto, spanish, catalan, galician, estonian, farsi, >>> > finnish, >>> > french, greek, monogreek, ancientgreek, croatian, hungarian, >>> interlingua, >>> > ibyc >>> > us, indonesian, icelandic, italian, latin, mongolian, dutch, norsk, >>> polish, >>> > por >>> > tuguese, pinyin, romanian, russian, slovenian, uppersorbian, serbian, >>> > swedish, >>> > turkish, ukenglish, ukrainian, loaded. >>> > (./sphinxmanual.cls >>> > Document Class: sphinxmanual 2009/06/02 Document class (Sphinx manual) >>> > (/usr/share/texmf/tex/latex/base/report.cls >>> > Document Class: report 2005/09/16 v1.4f Standard LaTeX document class >>> > (/usr/share/texmf/tex/latex/base/size10.clo))) >>> > (/usr/share/texmf/tex/latex/base/inputenc.sty >>> > (/usr/share/texmf/tex/latex/base/utf8.def >>> > (/usr/share/texmf/tex/latex/base/t1enc.dfu) >>> > (/usr/share/texmf/tex/latex/base/ot1enc.dfu) >>> > (/usr/share/texmf/tex/latex/base/omsenc.dfu))) >>> > (/usr/share/texmf/tex/latex/base/fontenc.sty >>> > (/usr/share/texmf/tex/latex/base/t1enc.def)) >>> > (/usr/share/texmf/tex/generic/babel/babel.sty >>> > (/usr/share/texmf/tex/generic/babel/english.ldf >>> > (/usr/share/texmf/tex/generic/babel/babel.def))) >>> > (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) >>> > (/usr/share/texmf/tex/latex/tools/longtable.sty) >>> > ! Undefined control sequence. >>> > \\ ->\let \reserved@e >>> > \relax \let \reserved@f \relax \@ifstar {\let >>> > \reserv... >>> > l.12 ...usepackage{amsxtra}', '\\usepackage{bm}')] >>> > >>> > ? >>> > >>> > -- >>> > You received this message because you are subscribed to the Google >>> Groups >>> > "sphinx-dev" group. >>> > To post to this group, send email to sphinx-dev@googlegroups.com. >>> > To unsubscribe from this group, send email to >>> > sphinx-dev+unsubscr...@googlegroups.com<sphinx-dev%2bunsubscr...@googlegroups.com> >>> . >>> > For more options, visit this group at >>> > http://groups.google.com/group/sphinx-dev?hl=en. >>> > >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "sphinx-dev" group. >>> To post to this group, send email to sphinx-dev@googlegroups.com. >>> To unsubscribe from this group, send email to >>> sphinx-dev+unsubscr...@googlegroups.com<sphinx-dev%2bunsubscr...@googlegroups.com> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/sphinx-dev?hl=en. >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "sphinx-dev" group. >> To post to this group, send email to sphinx-dev@googlegroups.com. >> To unsubscribe from this group, send email to >> sphinx-dev+unsubscr...@googlegroups.com<sphinx-dev%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/sphinx-dev?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "sphinx-dev" group. > To post to this group, send email to sphinx-dev@googlegroups.com. > To unsubscribe from this group, send email to > sphinx-dev+unsubscr...@googlegroups.com<sphinx-dev%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/sphinx-dev?hl=en. > -- You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To post to this group, send email to sphinx-dev@googlegroups.com. To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.