![無法使用xcookybooky編譯utf8](https://rvso.com/image/405378/%E7%84%A1%E6%B3%95%E4%BD%BF%E7%94%A8xcookybooky%E7%B7%A8%E8%AD%AFutf8.png)
由於我已經離開 Latex 很久了,我實際上面臨著 xcookybooky 套件(V1.5)內 utf8 的編譯問題。
我正在嘗試輸入我以 utf8 格式編寫的簡單食譜。
基本上,我有一個包含基本起始資訊的 Tex 檔案和一個包含配方的另一個檔案的呼叫。
第一個文件是:
\documentclass[%
a4paper,
%twoside,
%12pt
11pt
]{article}
\usepackage[utf8]{inputenc}
%\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[
%handwritten,
%myconfig,
nowarnings
]{xcookybooky}
\begin{document}
This is simple.
Les accents é ç à è fonctionnent correctement.
\include{Folder/TestUTF8}
\end{document}
第二個文件 TestUTF8 是最簡單的:
This is UTF8 Test.
\begin{recipe}
Test encoding
\end{recipe}
所以事實是:
- 如果我使用以下命令編譯主文件
[latin1]{inputenc}
:一切都正常。 [utf8]{inputenc}
如果我使用而不是編譯主文件[latin1]{inputenc}
:這會崩潰。[utf8]{inputenc}
如果我使用and comment\begin{recipe}
和:編譯主文件,\end{recipe}
效果很好。
我的檔案似乎是用 Utf8 編寫的,因為 TexMaker 在右下角向我顯示了該編碼。
如果有人可以提供協助,我將不勝感激。
謝謝
答案1
xcookybooky.sty
是 latin1 編碼的,並且它包含非 ascii 字符,這些字符應該在標頭中使用。該字元在 utf8 文件中無效。
您可以重設 utf8 檔案中的定義。然後它應該編譯:
\documentclass[%
a4paper,
%twoside,
%12pt
11pt
]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[nowarnings]{xcookybooky}
\IfLanguagePatterns{french}
{% French
\setHeadlines
{% translation
inghead = Ingrédients, %problem
prephead = Préparation, %problem
hinthead = Tuyau,
continuationhead = Suite,
continuationfoot = Suite page suivante,
portionvalue = Portions,
calory = Valeur calorifique
}
}{}
\begin{document}
This is simple.
Les accents é ç à è fonctionnent correctement.
This is UTF8 Test.
\begin{recipe}
Test encoding
\end{recipe}
%\include{Folder/TestUTF8}
\end{document}