Skip to content

Instantly share code, notes, and snippets.

@kaz-tk
Created June 30, 2014 09:26
Show Gist options
  • Save kaz-tk/2377571ea7f9a303f861 to your computer and use it in GitHub Desktop.
Save kaz-tk/2377571ea7f9a303f861 to your computer and use it in GitHub Desktop.
Sphinxで、画像を差し込むためのconf.py
latex_elements = {
'pointsize': '10pt',
'papersize': 'a4paper',
'transition': '',
'extraclassoptions': ',openany,oneside',
'classoptions': ',dvipdfmx',
'babel': '\\usepackage[japanese]{babel}',
}
latex_docclass = {'manual': 'jreport'}
latex_elements['preamble'] = r'''
\usepackage[export]{adjustbox}
\usepackage{letltxmacro}
\LetLtxMacro{\origincludegraphics}{\includegraphics}
\renewcommand*\includegraphics[2][max width=\textwidth,max height=\textheight,keepaspectratio]{%
\begin{minipage}{\columnwidth}
\begin{figure}[h!]
\origincludegraphics[#1]{#2}
\end{figure}
\end{minipage}
}
'''
#!/bin/bash -ex
echo "This script is used to make pdf"
echo " at Linux and Mac OSX with installed texlive 2013. "
bin_sphinx=`which sphinx-build`
dist=`uname -s`
echo ${bin_sphinx}
if [ -z ${bin_sphinx} ];then
echo "Error:"
echo " sphinx-build is not found."
echo ""
exit -1
fi
# Loading texlive environment.
if [ $dist = 'Darwin' ]; then
export PATH=$PATH:/usr/local/texlive/2013/bin/x86_64-darwin/
fi
if [ $dist = 'Linux' ]; then
export PATH=$PATH:/usr/local/texlive/2013/bin/x86_64-linux
fi
make latex
cd _build/latex
make all-pdf-ja
if [ $? != 0 ];then
echo "failed. but recover to make pdf"
fi
dvipdfmx Android.dvi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment