1

I was looking for a lightning symbol and came across this post:

The lightning symbol in an equation environment

I liked the lightning symbol from the ulsy package (from the second answer) and tried to use it. The first problem was that texlive does not come with this package. So I downloaded it from CTAN and followed the instructions to create the Uulsy.fd and ulsy.sty files. (I am using the files locally only because I intend to integrate in my overleaf project, which as far as I know does not support installing custom fonts.)

My actual problem is, when I use it in my document I only get a low resolution of the lightning bolt, especially when I am increasing the size (e.g. with scalebox or resizebox).

\documentclass{article}
\usepackage{graphicx}
\usepackage{ulsy}
\let\ulsyLightning\blitza

\begin{document}
        \resizebox{0.5\textheight}{!}{\ulsyLightning}
\end{document}

enter image description here

A few things I noticed: I tried different latex engines and get the same results with pdflatex and lualatex. However, by using just latex and then converting the .dvi file to .pdf with dvipdf, I get a lightning bolt with a much higher resolution. I noticed that pdflatex, as well as lualatex creating a file named ulsy10.600pk and latex ulsy10.8000pk. Since during the pdf-/lualatex I can see the message

kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 ulsy10

my assumption is that the 600pk/8000pk is related to the resolution of the created image which is used for the font.

enter image description here

So my question is, is it somehow possible to control the resolution and still using pdf-/lualatex?

1

The short answer to your question is that, for a bitmap font like ulsy, the resolution used by pdftex is defined by the variable \pdfpkresolution, which is set to 600 in the usual default configuration. The resolution used by dvips and the wrapper script dvipdf is set by a line reading

D 8000

in the file $TEXMF/dvips/config.pdf if it is not specified by a command line argument such as -D 8000. As another answer notes, there is a Type 1 version of the font that avoids these questions, but since it has been autotraced from Metafont output, the outlines are a bit crude.

The problem of low resolution partly arises from the fact that your TeX output is being scaled up at the Postscript level, and for a bitmap font, that means magnifying the existing pixels, rather than using more pixels. Setting the resolution to 8000 dpi partially compensates for this, but a better solution is either to use an outline font, or to scale the font when it is loaded, using a TeX command like

\font\bigulsy=ulsy10 scaled 10000

or the equivalent in LaTeX, instead of scaling the PostScript.

1

I suggest to get the postscript version of the font (from https://ctan.org/tex-archive/fonts/ps-type1/ulsy), put the pfa into fonts/type1/public/ulsy/ulsy.pfa, the map-file into fonts/map, run mktexlsr and activate the map-file with updmap (or add a \pdfmapline command).

\documentclass{article}
\usepackage{graphicx}
%\pdfmapline{=ulsy10 ulsy < ulsy.pfa} %or activate the map file
\usepackage{ulsy}
\let\ulsyLightning\blitza

\begin{document}
        \resizebox{0.5\textheight}{!}{\ulsyLightning}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.