Closed aminophen closed 2 years ago
For a question on TeX.SE I implemented this suggestion. You can probably find a cleaner way but maybe it is a starting point. The main issue is that pdfcrop does not work on eps files so this should be conditional on the image extension. My implementation (only for \smilesobabel
):
\DeclareOption{pdf}{\def\chemob@belimgExt{pdf}\def\chemob@bel@cropcmd#1{pdfcrop #1 #1}}
\DeclareOption{eps}{\def\chemob@belimgExt{eps}\let\chemob@bel@cropcmd\@undefined}
\newcommand\@smilesobabel[2]{%
\endgroup
\chemob@bel@exec{%
\smilesob@bel@obabelcmd{#1}{#2} 2>\smilesob@belGetName.log
&& \chemob@bel@svgtoimgcmd{\smilesob@belGetName}{\chemob@belimgExt} 2>>\smilesob@belGetName.log
|| rm -f \smilesob@belGetName.\chemob@belimgExt}%
\ifcsname chemob@bel@cropcmd\endcsname%
\chemob@bel@exec{\chemob@bel@cropcmd{\smilesob@belGetName.pdf}}\fi%
\chemob@bel@common@maybeimg{\smilesobabel@next}{\smilesob@belGetName}{SMILES string}%
\addtocounter{smilesob@belCounter}{1}% select next name
}
See the question on https://tex.stackexchange.com/questions/655477/how-to-draw-structures-from-smiles-using-latex.
Thanks for your advice!
For EPS, the program ps2eps can crop the margin, and it's installed via TeX Live. I will add "pdfcrop" and "ps2eps" into the package.
Note: with "ps2eps" the white background remains, but adding "clip" to the optional argument the image is properly cropped (similar to \includegraphics
).
Implemented 21cf582af1f2930b1c7bb9f1515f526f6d706d64. Default crop, and the package option "nocrop" restores the old behavior without crop.
Documentation to be written (including the above "clip" for eps).
Documentation done. 874ca5f4961e2f78dfcb5d7d6ab454de7edffc19
The behavior of SVG output of Open Babel 2.4.1 seems different from that of Open Babel 2.3.2. With the new version, the output image always has a square bounding box and the margins around the structure are bigger. Should I crop the margins (using pdfcrop?) before including it to the LaTeX document?