简体   繁体   中英

How to make sphinx document via pdflatex \raggedright?

如果我使用pdflatex如何使用\\raggedright命令将reST文档呈现到所有文本来呈现?

Use a custom template.

In the following example, I'll be using xelatex . I would copy the default template for xelatex from /usr/local/lib/python2.7/site-packages/docutils/writers/latex2e/xelatex.tex to a file called mytemplate.tex

The default template looks like this:

$head_prefix% generated by Docutils <http://docutils.sourceforge.net/>
% rubber: set program xelatex
\usepackage{fixltx2e}
\usepackage{fontspec}
% \defaultfontfeatures{Scale=MatchLowercase}
$requirements
%%% Custom LaTeX preamble
$latex_preamble
%%% User specified packages and stylesheets
$stylesheet
%%% Fallback definitions for Docutils-specific commands
$fallbacks$pdfsetup
$titledata
%%% Body
\begin{document}
$body_pre_docinfo$docinfo$dedication$abstract$body
\end{document}

You could add \\raggedright just after \\begin{document} .

For rendering the document, I'd use the following commands:

rst2xetex --template=mytemplate.tex --use-latex-docinfo mydoc.rst
xelatex mydoc.tex
xelatex mydoc.tex
rm -f *.out *.aux *.log mydoc.tex

(This is on a UNIX-like operating system.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM