Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40b9df2

Browse files
committed
add some information about using graphics with the Python document
classes
1 parent 80bd5ca commit 40b9df2

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

Doc/doc/doc.tex

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,6 +1828,99 @@ \section{Processing Tools \label{tools}}
18281828
PostScript versions of the formatted documentation.
18291829

18301830

1831+
\section{Including Graphics \label{graphics}}
1832+
1833+
The standard documentation included with Python makes no use of
1834+
diagrams or images; this is intentional. The outside tools used to
1835+
format the documentation have not always been suited to working with
1836+
graphics. As the tools have evolved and been improved by their
1837+
maintainers, support for graphics has improved.
1838+
1839+
The internal tools, starting with the \program{mkhowto} script, do
1840+
not provide any direct support for graphics. However,
1841+
\program{mkhowto} will not interfere with graphics support in the
1842+
external tools.
1843+
1844+
Experience using graphics together with these tools and the
1845+
\code{howto} and \code{manual} document classes is not extensive,
1846+
but has been known to work. The basic approach is this:
1847+
1848+
\begin{enumerate}
1849+
\item Create the image or graphic using your favorite
1850+
application.
1851+
1852+
\item Convert the image to a format supported by the conversion to
1853+
your desired output format. If you want to generate HTML or
1854+
PostScript, you can convert the image or graphic to
1855+
encapsulated PostScript (a \file{.eps} file); \LaTeX2HTML
1856+
can convert that to a \file{.gif} file; it may be possible
1857+
to provide a \file{.gif} file directly. If you want to
1858+
generate PDF, you need to provide an ``encapsulated'' PDF
1859+
file. This can be generated from encapsulated PostScript
1860+
using the \program{epstopdf} tool provided with the te\TeX{}
1861+
distribution on Linux and \UNIX.
1862+
1863+
\item In your document, add this line to ``import'' the general
1864+
graphics support package \code{graphicx}:
1865+
1866+
\begin{verbatim}
1867+
\usepackage{graphicx}
1868+
\end{verbatim}
1869+
1870+
\item Where you want to include your graphic or image, include
1871+
markup similar to this:
1872+
1873+
\begin{verbatim}
1874+
\begin{figure}
1875+
\centering
1876+
\includegraphics[width=5in]{myimage}
1877+
\caption{Description of my image}
1878+
\end{figure}
1879+
\end{verbatim}
1880+
1881+
In particular, note for the \macro{includegraphics} macro
1882+
that no file extension is provided. If you're only
1883+
interested in one target format, you can include the
1884+
extension of the appropriate input file, but to allow
1885+
support for multiple formats, omitting the extension makes
1886+
life easier.
1887+
1888+
\item Run \program{mkhowto} normally.
1889+
\end{enumerate}
1890+
1891+
If you're working on systems which support some sort of
1892+
\program{make} facility, you can use that to ensure the intermediate
1893+
graphic formats are kept up to date. This example shows a
1894+
\file{Makefile} used to format a document containing a diagram
1895+
created using the \program{dia} application:
1896+
1897+
\begin{verbatim}
1898+
default: pdf
1899+
all: html pdf ps
1900+
1901+
html: mydoc/mydoc.html
1902+
pdf: mydoc.pdf
1903+
ps: mydoc.ps
1904+
1905+
mydoc/mydoc.html: mydoc.tex mygraphic.eps
1906+
mkhowto --html $<
1907+
1908+
mydoc.pdf: mydoc.tex mygraphic.pdf
1909+
mkhowto --pdf $<
1910+
1911+
mydoc.ps: mydoc.tex mygraphic.eps
1912+
mkhowto --postscript $<
1913+
1914+
.SUFFIXES: .dia .eps .pdf
1915+
1916+
.dia.eps:
1917+
dia --nosplash --export $@ $<
1918+
1919+
.eps.pdf:
1920+
epstopdf $<
1921+
\end{verbatim} % $ <-- bow to font-lock
1922+
1923+
18311924
\section{Future Directions \label{futures}}
18321925

18331926
The history of the Python documentation is full of changes, most of

0 commit comments

Comments
 (0)