diff options
Diffstat (limited to 'graphics/chemobabel/chemobabel.dtx')
-rw-r--r-- | graphics/chemobabel/chemobabel.dtx | 104 |
1 files changed, 84 insertions, 20 deletions
diff --git a/graphics/chemobabel/chemobabel.dtx b/graphics/chemobabel/chemobabel.dtx index 2158f591a9..be2ddecfe7 100644 --- a/graphics/chemobabel/chemobabel.dtx +++ b/graphics/chemobabel/chemobabel.dtx @@ -17,6 +17,7 @@ \usepackage[nofontspec,defaultsups]{newpxtext} \usepackage[zerostyle=c,straightquotes]{newtxtt} \usepackage{newpxmath} +\usepackage{ascmac} \usepackage[librsvg]{chemobabel} \usepackage[bookmarksnumbered=true,hidelinks,% pdftitle={User Manual for chemobabel.sty},% @@ -64,17 +65,19 @@ a \LaTeX\ package for \textbf{generating chemical structural formulas} to be inserted in your documents. The formulas can be generated \textbf{from many kinds of chemical data formats}, including MDL Molfiles, ChemDraw files and even from -SMILES notations, with the help of Open Babel and Inkscape. -The formulas below are generated using this method. +SMILES notations, with the help of Open Babel. +The formulas below are generated using this method.\footnote{Unless +otherwise noted, this documentation used \Lcode{\input{obversion.txt}}} 日本語版ドキュメントはchemobabel-ja.pdfを参照してください。 %</en> %<*ja> この文書では,\textbf{化学構造式を生成}して\LaTeX の文書中に挿入するための -パッケージである\Lpack{chemobabel.sty}と同梱リソースの使い方を説明します。 +パッケージである\Lpack{chemobabel.sty}の使い方を説明します。 構造式はOpen Babelの機能を利用することにより,MDL Molfile, ChemDrawファイル, さらにはSMILES表記法を含む\textbf{さまざまな化学データ形式から生成}できます。 -以下の構造式はこの方法によって出力されたものです。 +以下の構造式はこの方法によって出力されたものです\footnote{特に断りがない +限り,この文書で使用した版は\Lcode{\input{obversion.txt}}です。}。 For English documentation, please refer to chemobabel-en.pdf. %</ja> @@ -88,8 +91,8 @@ For English documentation, please refer to chemobabel-en.pdf. \begin{figure}[ht] \centering - \chemobabel[width=90mm]{draw/ATP.cdx}{} \hspace{1cm} - \chemobabel*[width=35mm]{draw/Glucose.cdx} + \chemobabel[width=80mm]{draw/ATP.cdx}{} \hspace{1cm} + \chemobabel*[width=30mm]{draw/Glucose.cdx} \caption{ATP (Adenosine triphosphate) \& Glucose (from ChemDraw files)} \end{figure} \begin{center}\small @@ -121,6 +124,32 @@ becomes wrong.\\ See \url{https://github.com/openbabel/openbabel/issues/338} %<ja>問い合わせや改善案などはGitHubのIssuesへお願いします。 \end{figure} +\begin{figure}[ht] +\centering +%<en>Also available on CTAN: +%<ja>CTANからも入手可能です → +\url{https://www.ctan.org/pkg/chemobabel}\par +%<en>Distributed with \TeX\ Live and MiK\TeX. +%<en>Below is a short description for CTAN:\par +%<ja>\TeX\ LiveやMiK\TeX でも配布されています。 +%<ja>以下はCTANの短い紹介文です。\par +\begin{screen} +This package provides a way to convert and include +chemical structure graphics from various chemical formats, +such as ChemDraw files, MDL molfile or SMILES notations +using Open Babel. +To use this \LaTeX\ package, it is necessary to enable execution +of the following external commands via \Lcode{latex -shell-escape}. +\begin{itemize} + \item \Lcode{obabel} (Open Babel) + \item \Lcode{inkscape} or \Lcode{rsvg-convert} + (for SVG -> PDF/EPS conversion) + \item \Lcode{pdfcrop} or \Lcode{ps2eps} + (optional; for cropping large margins of PDF/EPS) +\end{itemize} +\end{screen} +\end{figure} + \clearpage \setcounter{tocdepth}{3} \tableofcontents @@ -206,7 +235,7 @@ This new package, \Lpack{chemobabel.sty}, will offer a new choice for chemists who need chemical structures inserted in their \LaTeX\ documents. In this method, we use \href{http://openbabel.org/}{Open Babel} for generating chemical structural formulas in SVG format, -and \href{https://inkscape.org/en/}{Inkscape} for converting SVG to PDF. +and \href{https://inkscape.org/en/}{Inkscape} for converting SVG to PDF/EPS. Both programs are open source and cross-platform, and being actively maintained. %</en> %<*ja> @@ -214,7 +243,8 @@ Both programs are open source and cross-platform, and being actively maintained. 挿入する必要がある化学者に新たな選択肢を提供することでしょう。 この方法では,\href{http://openbabel.org/}{Open Babel}によって SVG形式の構造式画像を生成し, -さらに\href{https://inkscape.org/ja/}{Inkscape}によってSVGからPDFに変換します。 +さらに\href{https://inkscape.org/ja/}{Inkscape}によってSVGから +PDFまたはEPS形式の画像に変換します。 どちらのプログラムもオープンソースかつクロスプラットフォームであり, 盛んに開発が行われています。 %</ja> @@ -305,16 +335,21 @@ Noel O'Blog の記事\cite{NOB1}, \cite{NOB2}とコメント\cite{JLA}を見つ First, you have to install \href{http://openbabel.org/}{Open Babel} and \href{https://inkscape.org/en/}{Inkscape} (or \href{http://librsvg.sourceforge.net/download/}{librsvg}) on your -computer, and export PATH to the command-line binary of both programs, +computer, and export PATH to the required command-line programs, \Lcode{obabel} and \Lcode{inkscape} (or \Lcode{rsvg-convert}). +The package also uses \Lcode{pdfcrop} (or \Lcode{ps2eps}) to +crop large margins, but it is included in \TeX\ Live. You can confirm by executing following commands: %</en> %<*ja> 初めにコンピュータに\href{http://openbabel.org/}{Open Babel}と \href{https://inkscape.org/ja/}{Inkscape}(または \href{http://librsvg.sourceforge.net/download/}{librsvg})をインストールし, -コマンドライン実行ファイルである -\Lcode{obabel}と\Lcode{inkscape}(または\Lcode{rsvg-convert})にPATHを通します。 +必要なコマンドラインプログラムである +\Lcode{obabel}と\Lcode{inkscape}(または\Lcode{rsvg-convert})に +PATHを通します。 +なお,生成画像の大きな余白を切り取るために\Lcode{pdfcrop}(または +\Lcode{ps2eps})も利用しますが,これは\TeX\ Liveに収録されています。 正しくPATHが通っているかどうかは以下のコマンドによって確認できます: %</ja> %<en>In UNIX operating system: @@ -429,8 +464,9 @@ obabelやinkscapeを呼んで実行できるようになります。 \begin{verbatim} $ platex -shell-escape test.tex \end{verbatim} -すると \verb|chemobabelimgdir| 以下に「chemobabelimg[NUM].pdf」という -ファイルが生成します。得られたtest.dviに対して +するとサブディレクトリ \verb|chemobabelimgdir| 以下に +「chemobabelimg[NUM].pdf」というファイルが生成します。 +得られたtest.dviに対して \begin{verbatim} $ dvipdfmx test.dvi \end{verbatim} @@ -455,7 +491,7 @@ $ dvipdfmx test.dvi \begin{itemize} \item The optional parameter \Lmeta{options} in the box brackets is passed to \verb|\includegraphics|. - If omitted, the default ``scale=1' is assumed. + If omitted, the default ``clip,scale=1' is assumed. \item The first mandatory parameter \Lmeta{filename} is the file name which contains chemical structural formula. \item The second mandatory parameter \Lmeta{obabel options} @@ -470,7 +506,7 @@ a shorthand form \verb|\chemobabel*| is also available \verb|\chemobabel| は1つのオプション引数と2つの必須引数をとります。 \begin{itemize} \item 角括弧内のオプション引数は \verb|\includegraphics| に渡されます。 - 省略された場合は \verb|scale=1| とみなされます。 + 省略された場合は \verb|clip,scale=1| とみなされます。 \item 必須引数の1つめには化学構造式が描かれたファイル名を与えます。 \item 必須引数の2つめには \verb|obabel| に送るオプション (例は第\ref{depict}節を参照)を指定します。 @@ -627,8 +663,11 @@ dvipsなどのPDF非対応のドライバを使用する場合は,EPS形式の \usepackage[eps]{chemobabel} \end{verbatim} %<*en> -The option \verb|eps| switches the image format (that is, output format -from Inkscape) into EPS (since \Lver{v0.9d [2016/02/28]}). +The option \verb|eps| switches the image format +(that is, output format from Inkscape) into EPS (since +\Lver{v0.9d [2016/02/28]}).\footnote{Moreover, since +\Lver{v0.9l [2022/10/22]}, the package automatically switches to +EPS mode when using dvips.} You can also change the image conversion program from ``Inkscape'' to ``rsvg-convert'' (since \Lver{v0.9e [2016/03/07]}). @@ -637,7 +676,9 @@ For this purpose, use \verb|librsvg| option: %</en> %<*ja> というように \verb|eps| オプションを指定すれば,内部でInkscapeから出力される -画像形式をPDFではなくEPSに変更します(\Lver{v0.9d [2016/02/28]}以降)。 +画像形式をPDFではなくEPSに変更します(\Lver{v0.9d [2016/02/28]}以降) +\footnote{\Lver{v0.9l [2022/10/22]}以降ではさらに,dvipsの場合に +自動的にEPSに切り替えるようにしました。}。 また,画像変換プログラムを Inkscape から rsvg-convert に変更することもできます (\Lver{v0.9e [2016/03/07]}以降)。 @@ -723,7 +764,7 @@ can be used. With \verb|extract| option, all \Lpack{chemobabel} does is extracting all \verb|\chemobabel| and \verb|\smilesobabel| commands from the original \LaTeX\ file. -You will get ``ChemFigFile.tex'' in the same directory, a minimal +You will get ``ChemFigFile.tex'' in the current directory, a minimal \LaTeX\ source file which includes all \verb|\chemobabel| and \verb|\smilesobabel| commands. You can simply typeset it by @@ -737,7 +778,7 @@ $ platex test.tex \verb|extract| オプションを付けると,\Lpack{chemobabel}パッケージは 単に元の\LaTeX ソースから \verb|\chemobabel| と \verb|\smilesobabel| コマンド だけを抽出するはたらきをします。 -その結果,同じディレクトリに「ChemFigFile.tex」というファイルが生成します。 +その結果,作業ディレクトリに「ChemFigFile.tex」というファイルが生成します。 これは元のソースに書かれていた \verb|\chemobabel| と \verb|\smilesobabel| コマンド をすべて含む最小の \LaTeX ソースで,これは直接pdflatexでタイプセットできます。 %</ja> @@ -773,6 +814,27 @@ $ dvipdfmx test.dvi この方法を用いれば,タイプセットに要する時間を大幅に短縮することも期待できます。 %</ja> +%<*en> +\paragraph{Note on the option \Lcode{-output-directory}} + +When using the option \Lcode{-output-directory} of \TeX, +the extracted code ``ChemFigFile.tex'' goes there +but the subdirectory \verb|chemobabelimgdir| and +generated images stay in the current working directory. +To process the resulting files correctly, it would be +necessary to move files properly. +%</en> +%<*ja> +\paragraph{注意:\Lcode{-output-directory}オプション} + +\TeX の\Lcode{-output-directory}オプションを使用すると, +抽出ファイル「ChemFigFile.tex」はその指定先に書き出されますが, +サブディレクトリ \verb|chemobabelimgdir| と生成画像は +現在のディレクトリとなります。 +従って,抽出ファイルと元のファイルを正しく処理するためには +ファイルを適切に配置する必要があります。 +%</ja> + \clearpage %<*en> @@ -1198,6 +1260,8 @@ handled properly by changing category codes temporarily (like \verb+\verb+). \\ 2022/10/09 v0.9k & Add \verb|\chemobabel*| and \verb|\smilesobabel*|. \\ & Warn if a user need to run another \LaTeX. \\ & Improve \verb|[extract]| to take over user-given package options. \\ +2022/10/22 v0.9l & Default to EPS mode if PDF inclusion is unsupported by the driver. \\ + & Default \verb|clip| for image inclusion. \\ \end{tabular} \end{table} |