3

MWE

\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{currfile}

\begin{document}

%File Name: ÖüğşiÇ.tex

\jobname

\currfilename

\end{document}

And output:

enter image description here

Is it possible below the image?

enter image description here

1
  • 1
    Using in a filename others characters that numbers or basic Latin alphabet is still today ask for problems. However, at least with xelatex, without the first 3 lines of your preamble and using \usepackage{fontspec} \setmainfont[Ligatures=TeX]{DejaVu Serif} the ouput is correct.
    – Fran
    Apr 20, 2016 at 4:08

1 Answer 1

3

The use of

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

indicates you are using pdfTeX, an 8-bit engine. This cannot represent the full range of Unicode code points internally, and there is only a 1-to-1 mapping between 8-bit and Unicode code points for slots 0-127: essentially for A-Za-z in terms of letters. To get other characters to print, the inputenc package makes various code points active, and uses this to remap what look to the engine like 2, 3 or 4 'characters' to a single slot in the font.

This works fine for normal text (if you simply type in ÖüğşiÇ it will print) but not for \jobname as it is a 'string': the category codes of the characters are already set before it's read. You have a couple of options:

  • Use a Unicode engine (XeTeX, LuaTeX) which does handle the full range, plus a font that has the right slots set up (basically \usepackage{fontspec})
  • Tell TeX to rescan (reassign category codes) the input: a bit tricky due to the way \jobname works. Something like

    \begingroup
    \edef\x{\endgroup\noexpand\scantokens{\jobname}}\x
    
1
  • perfect working...
    – Özgür
    Apr 21, 2016 at 1:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .