I want to export chemical lewis structures as transparent PNG-files in order to use them in Word documents.
So I want to achieve whats described in this post. I just can't get it to work because my understanding of LaTeX is very limited.
This is my code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{verbatim}
\pagenumbering{gobble}
\usepackage{chemfig}
\usepackage[version=4]{mhchem}
\renewcommand*\printatom[1]{\sffamily{#1}}
\newcommand*\forcelen[1]{#1/\CF@atom@sep}
\newcommand{\pol}[2][red]{$\color{#1} \delta^{#2}$}
\begin{document}
\chemfig{
\charge{135:5pt=\pol{+}}{Si}
(-[0]\charge{0=|,90=|,270=|,0:9pt=\pol[blue]{-}}{Br})
(-[2]\charge{0=|,90=|,180=|,90:8pt=\pol[blue]{-}}{Br})
(-[4]\charge{90=|,180=|,270=|,180:8pt=\pol[blue]{-}}{Br})
(-[6]\charge{0=|,180=|,270=|,270:7pt=\pol[blue]{-}}{Br})}
\end{document}
This is what it looks like:
When I use \documentclass{standalone} it crops the document too close:
In the post mentioned above the OP wrote:
There is a border class option which sets the border around the content (the default is 0.5bp). This option excepts either one (border for all sides), two (left/right, top/bottom) or four values (left, bottom, right, top).
I have no clue how to implement the border though.
Regarding the PNG Output another user wrote this Shell-Script but I don't know how to use it. Where do I need to save the script and where do I place the code to call it in the LaTeX document?


\documentclass[border=1mm]{standalone}adds 1mm to each side. – Torbjørn T. May 15 '21 at 11:38