2

I would like to construct a filename from a komavar. Something like this

\begin{filecontents}{mylco.lco}
\usepackage{graphicx}
\usepackage{eso-pic}
\usepackage{ifthen}

\newkomavar{extfi}

\usepackage{etoolbox}
\AtEndPreamble{
       \setkomavar{extfi}{mas}%
      \def\logoname{uni_\usekomavar{extfi}}
      \setkomavar{fromlogo}{\parbox{\paperwidth}{\vspace*{27mm}\hspace*{17.3mm}\includegraphics{\logoname}}}%

}

\end{filecontents}
\documentclass
[
mylco
]
{scrlttr2}

\usepackage{lipsum}

\begin{document}
\begin{letter}{you there}
   \opening{Hey,}
   \lipsum[36]
   \closing{Cya}
\end{letter}
\end{document}

Ideally I would be able to use multiple komavars to construct the file name but I would also be happy with 1. Any ideas?

1 Answers1

3

\usekomavar is not expandable and so not suitable for this task. You can try to use the inner csname:

\documentclass{scrlttr2}
\usepackage{graphicx}
\newkomavar{extfi}
\setkomavar{extfi}{image}%
\def\logoname{example-\csname scr@extfi@var\endcsname}
\begin{document}
\includegraphics{\logoname}
\end{document}
Ulrike Fischer
  • 327,261