auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Set background using \special{...}


From: Dimitar Dimitrov
Subject: Set background using \special{...}
Date: Wed, 8 Feb 2023 00:15:53 +0100

Suppose I have the following `math.tex` file

```latex
\documentclass[12pt]{article}

\special{background White}

\usepackage[active,tightpage]{preview}

\begin{document}
\begin{preview}
\fontsize{14}{17}\selectfont $x$
\end{preview}
\end{document}
```

I want to get an SVG file with a white background, so I do:
1. `latex math.tex`
2. `dvisvgm -o math.svg —no-fonts math.dvi`

The `\special{background White}` is required by `dvisvgm ` in order to add a white rectangle to the SVG. 

However, the background is missing. If, on the other hand, I deactivate the `preview` package (by removing the `active` option) I get the correct background but then I miss some of the goodies coming with `preview`.

I don’t know what is happening under the hood in `preview`, but it seems that it suppresses / overwrites the `\special{background White}` command. Maybe I have to pass some option to avoid this? Or maybe there is a different way to achieve this. 

The reason I want to do all this is because the `imgmath` Sphinx extension uses the same approach for creating SVGs from latex equations to be included in some HTML documentation (which works fine except that I cannot change the background using `dvisvgm`). 

Thanks,
Mitko

reply via email to

[Prev in Thread] Current Thread [Next in Thread]