Here is my MWE:
\documentclass[ngerman,german,14pt,twoside,openany]{scrbook}
\usepackage[left=2.5cm,right=2.5cm,top=2cm,bottom=2.5cm]{geometry}
\usepackage[ngerman]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{currfile}
\begin{document}
\ifcurrfiledir{folder1/folder2/Jungs}{Lieber}{Liebe}
\end{document}
I am struggling with the following problem:
In german language you talk to boy with the word "Lieber…" and you talk to a girl with the word "Liebe…" (for our english speaking friends: this means "Dear…". Now I would like to automate these words in a way that if the document is in the folder "folder1/folder2/Jungs" (Jungs means boy) then the word "Lieber" should be inserted and for the rest (i.e. the girls) the word "Liebe" should be used. For this purpose I tried the "currfile" package by Martin Scharrer with the code detailed above. But this doesn´t work since in both cases Lualatex returns "Liebe". Can anyone help me please?
Best Answer
If you want to run LuaLaTeX from within the directory, you cannot test with
\ifcurrfiledir
, because the\currfiledir
is relative to the current working directory. But you can (always) do a test with\currfileabspath
, e.g.:Note: Because of option
abspath
you have to run LaTeX with option-recorder
. If the file above is namedjungsornot.tex
you would, e.g., have to runpdflatex -recorder jungsornot.tex
instead ofpdflatex jungsornot.tex
.