I wrote a bash
script osmimage (source for tests), that downloads a map given by an address. I want to write a package that calls this script with \write18
, but there are a few problems.
The following example works with lualatex
:
\documentclass{article}
%\usepackage[latin1]{inputenc}
%\usepackage[T1]{fontenc}
\usepackage{graphicx}
\def\loc{Bergheimer Straße 110A, 69115 Heidelberg, Germany}
%\def\loc{Rathausmarkt 1, 20095 Hamburg, Deutschland}
\newcommand*\getmap%
{%
%\immediate\write18{osmimage -l "\loc"}
\immediate\write18{osmimage -l "\unexpanded\expandafter{\loc}"}
}%
\begin{document}
\section{Example}
Did you ever wanted to visit the Dante e.V. office? Here we go:
\getmap
\begin{center}
\includegraphics[width=10cm]{osmimage}
\end{center}
\end{document}
Code edited after Ulrike's comment. Still a problem with pdflatex
and other encoding than utf-8
!
If i run this file with pdflatex
(with inputenc
and fontenc
) the transfer of the address no longer works. Without inputenc
or fontenc
i get all kinds of strange output in the URL (see log).
If i use an ASCII-only address like the Hamburg town hall, it also works with pdflatex
!
So there seems to be some kind of encoding problem as the script expects UTF-8
or maybe url-encoding.
Any idea? It wouldn't be very nice to limit the package to lualatex
or maybe xelatex
(not tested yet)utf-8
encoding
\immediate\write18{osmimage -l "\unexpanded\expandafter{\loc}"}
. See also tex.stackexchange.com/a/75958/2388pdflatex
andutf8
encoding. There are still encoding problems, when usinglatin1
instead. Anyway, thank you very much, Mrs.(!!!) Fischer ;-)