# How can I use cjk path in \include command on windows?

I want to use \input or \include command to include a file that name with cjk characters.

\documentclass[UTF8]{ctexart}
\title{input with cjk path}
\begin{document}
\maketitle
\input{中文}
\end{document}


and the 中文.tex is

hello, world


I have tried utf8 encoding, gbk encoding, but xelatex shows the same error

LaTeX Error: File 涓枃.tex' not found.


operating system is windows and I use xelatex command:

xelatex a.tex


and I have tried changed the code page, it still not working:

chcp 65001
xelatex a.tex


and a.log show

This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017/W32TeX)(preloaded format=xelatex 2017.6.21)  3 JUL 2017 20:55
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**./a.tex
(./a.tex
LaTeX2e <2017-04-15>
...
...
...
LaTeX Font Info:    External font cmex10' loaded for size
(Font)              <8> on input line 4.
LaTeX Font Info:    External font cmex10' loaded for size
(Font)              <6> on input line 4.

LaTeX Warning: No \author given.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: tex)

Enter file name: X

)
(\end occurred when \ifx on line 5 was incomplete)
(\end occurred when \ifx on line 5 was incomplete)
Here is how much of TeX's memory you used:
19344 strings out of 493005
406504 string characters out of 6131656
441240 words of memory out of 5000000
23197 multiletter control sequences out of 15000+600000
6602 words of font info for 39 fonts, out of 8000000 for 9000
1348 hyphenation exceptions out of 8191
57i,6n,68p,10436b,270s stack positions out of 5000i,500n,10000p,200000b,80000s

No pages of output.

• The file should be in UTF-8 encoding for xetex. – David Carlisle Jul 2 '17 at 17:05

If I generate the 中文.tex hello world file, and save the main file in UTF-8 it works for me with windows 10 (and texlive 2017 cygwin tex)

If I then re-save the main file in gbk encoding I get a file not found error In my case I get

! LaTeX Error: File ����.tex' not found.


with all the characters being replaced by U+fffd "replacement character" rather than showing wrong characters as in your example, but the details of the utf-8 decoding may depend on the version of xetex that you have.

• thanks for answer. the a.tex file's encoding is utf-8. and I use texlive without cygwin. I think the console showing wrong characters since my terminal's encoding is cp936, while the other name of gbk. and I chcp code page 65001, it can show the right characters. is there any way to use input with cjk path on windows without cygwin? – txlg Jul 3 '17 at 12:07
• @txlg I think it should just work, (although I do not want to install a native windows texlive to check) there are plenty of windows users here who can check so leave the question open, and see who answers. Rather than show the missing file message from the terminal which is affected by your terminal settings, can you show the message from the log (which should be in utf8 if the original input was utf8) – David Carlisle Jul 3 '17 at 12:33
• sorry for the log file. but the log file is to long, it over 1000 lines. so i only put the message I think usefull: This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017/W32TeX) (preloaded format=xelatex 2017.6.21) 3 JUL 2017 20:55 entering extended mode restricted \write18 enabled. %&-line parsing enabled. **./a.tex (./a.tex LaTeX2e <2017-04-15> .... LaTeX Font Info: External font cmex10' loaded for size (Font) <6> on input line 4. LaTeX Warning: No \author given. ! LaTeX Error: File 中文.tex' not found. Type X to quit or <RETURN> to proceed – txlg Jul 3 '17 at 12:57
• @txlg: I tried with the article class (to avoid font problems), and it works on windows 10 with miktex but not with texlive 2017. – Ulrike Fischer Jul 3 '17 at 13:04
• @txlg so in the log it is 中文.tex` so basically I think you have done everything right, it just does not work in your implementation. see Ulrike's comment above. – David Carlisle Jul 3 '17 at 13:12