Is there a way to make fancyhdr with pagestyle fancy to be compatible with Chinese language?
I successfully can compile with Chinese characters in my documents using CJKutf8
. However it makes all my files, that use fancyhdr
with pagestyle fanc
to throw encoding related errors during compilation.
Minimal example to reproduce (assuming that cjk support is installed on the system and running):
documentclass{article}
usepackage{CJKutf8}
usepackage{fancyhdr}
%pagestyle{fancy} % <---- uncomment to throw error in compile
begin{document}
begin{CJK*}{UTF8}{gbsn}
section{前言}
section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
end{CJK*}
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
begin{CJK*}{UTF8}{bsmi}
這是繁體中文。
end{CJK*}
end{document}
Example was taken from here and extended.
Uncommenting pagestyle{fancy}
produces the following error:
! PACKAGE INPUTENC ERROR: UNICODE CHAR Ņ� (U+5173)
(INPUTENC) NOT SET UP FOR USE WITH LATEX.
SEE THE INPUTENC PACKAGE DOCUMENTATION FOR EXPLANATION.
Type H <return> for immediate help.
Now I don't want to use xetex or luatax as workarounds and I also have created some quite complex headers in my documents, which I'd like to keep.
So my question is, if there is a way to resolve this error for example by adding a specific package or configure fancyhdr
correctly.
fancyhdr cjk chinese
add a comment |
I successfully can compile with Chinese characters in my documents using CJKutf8
. However it makes all my files, that use fancyhdr
with pagestyle fanc
to throw encoding related errors during compilation.
Minimal example to reproduce (assuming that cjk support is installed on the system and running):
documentclass{article}
usepackage{CJKutf8}
usepackage{fancyhdr}
%pagestyle{fancy} % <---- uncomment to throw error in compile
begin{document}
begin{CJK*}{UTF8}{gbsn}
section{前言}
section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
end{CJK*}
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
begin{CJK*}{UTF8}{bsmi}
這是繁體中文。
end{CJK*}
end{document}
Example was taken from here and extended.
Uncommenting pagestyle{fancy}
produces the following error:
! PACKAGE INPUTENC ERROR: UNICODE CHAR Ņ� (U+5173)
(INPUTENC) NOT SET UP FOR USE WITH LATEX.
SEE THE INPUTENC PACKAGE DOCUMENTATION FOR EXPLANATION.
Type H <return> for immediate help.
Now I don't want to use xetex or luatax as workarounds and I also have created some quite complex headers in my documents, which I'd like to keep.
So my question is, if there is a way to resolve this error for example by adding a specific package or configure fancyhdr
correctly.
fancyhdr cjk chinese
add a comment |
I successfully can compile with Chinese characters in my documents using CJKutf8
. However it makes all my files, that use fancyhdr
with pagestyle fanc
to throw encoding related errors during compilation.
Minimal example to reproduce (assuming that cjk support is installed on the system and running):
documentclass{article}
usepackage{CJKutf8}
usepackage{fancyhdr}
%pagestyle{fancy} % <---- uncomment to throw error in compile
begin{document}
begin{CJK*}{UTF8}{gbsn}
section{前言}
section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
end{CJK*}
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
begin{CJK*}{UTF8}{bsmi}
這是繁體中文。
end{CJK*}
end{document}
Example was taken from here and extended.
Uncommenting pagestyle{fancy}
produces the following error:
! PACKAGE INPUTENC ERROR: UNICODE CHAR Ņ� (U+5173)
(INPUTENC) NOT SET UP FOR USE WITH LATEX.
SEE THE INPUTENC PACKAGE DOCUMENTATION FOR EXPLANATION.
Type H <return> for immediate help.
Now I don't want to use xetex or luatax as workarounds and I also have created some quite complex headers in my documents, which I'd like to keep.
So my question is, if there is a way to resolve this error for example by adding a specific package or configure fancyhdr
correctly.
fancyhdr cjk chinese
I successfully can compile with Chinese characters in my documents using CJKutf8
. However it makes all my files, that use fancyhdr
with pagestyle fanc
to throw encoding related errors during compilation.
Minimal example to reproduce (assuming that cjk support is installed on the system and running):
documentclass{article}
usepackage{CJKutf8}
usepackage{fancyhdr}
%pagestyle{fancy} % <---- uncomment to throw error in compile
begin{document}
begin{CJK*}{UTF8}{gbsn}
section{前言}
section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
end{CJK*}
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
begin{CJK*}{UTF8}{bsmi}
這是繁體中文。
end{CJK*}
end{document}
Example was taken from here and extended.
Uncommenting pagestyle{fancy}
produces the following error:
! PACKAGE INPUTENC ERROR: UNICODE CHAR Ņ� (U+5173)
(INPUTENC) NOT SET UP FOR USE WITH LATEX.
SEE THE INPUTENC PACKAGE DOCUMENTATION FOR EXPLANATION.
Type H <return> for immediate help.
Now I don't want to use xetex or luatax as workarounds and I also have created some quite complex headers in my documents, which I'd like to keep.
So my question is, if there is a way to resolve this error for example by adding a specific package or configure fancyhdr
correctly.
fancyhdr cjk chinese
fancyhdr cjk chinese
edited 18 hours ago
Jankapunkt
asked 18 hours ago
JankapunktJankapunkt
1185
1185
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
These days using luatex or xelatex for non latin scripts is probably recommended but you can re-assert the CJK processing so that it is in scope in the heading. Simpler to hide it in a macro so it is safe from expansion and uppercasing issues.
documentclass{article}
usepackage{CJKutf8}
usepackage{fancyhdr}
pagestyle{fancy} % <---- uncomment to throw error in compile
protecteddefzzzA{begin{CJK*}{UTF8}{gbsn}前言end{CJK*}}
protecteddefzzzB{begin{CJK*}{UTF8}{gbsn}关于数学部分end{CJK*}}
begin{document}
begin{CJK*}{UTF8}{gbsn}
section{zzzA}
section{zzzB}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
end{CJK*}
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
begin{CJK*}{UTF8}{bsmi}
這是繁體中文。
end{CJK*}
end{document}
1
Great simple solution, the macro wrapping works without the need for additional packages.
– Jankapunkt
17 hours ago
add a comment |
If you're free to use LuaLaTeX or XeLaTeX and have a suitable system font, i.e., one which has the requisite Chinese characters, you can dispense with switching between CJK*
and "ordinary" environments.
The following example compiles equally well under both LuaLaTeX and XeLaTeX on my MacOS system, MacTeX2018, the fontspec
package, and the SimSun system font.
documentclass{article}
usepackage{fontspec} % for "setmainfont" macro
setmainfont{SimSun} % or some other suitable font
%usepackage{CJKutf8} % not needed
usepackage{fancyhdr}
pagestyle{fancy}
setlengthparindent{0pt} % just for this example
begin{document}
%begin{CJK*}{UTF8}{gbsn} % not needed
section{前言}
section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English
(Latin script) without adding extra environments.
%end{CJK*} % not needed
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
%begin{CJK*}{UTF8}{bsmi} % not needed
這是繁體中文。
%end{CJK*} % not needed
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478696%2fis-there-a-way-to-make-fancyhdr-with-pagestyle-fancy-to-be-compatible-with-chine%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
These days using luatex or xelatex for non latin scripts is probably recommended but you can re-assert the CJK processing so that it is in scope in the heading. Simpler to hide it in a macro so it is safe from expansion and uppercasing issues.
documentclass{article}
usepackage{CJKutf8}
usepackage{fancyhdr}
pagestyle{fancy} % <---- uncomment to throw error in compile
protecteddefzzzA{begin{CJK*}{UTF8}{gbsn}前言end{CJK*}}
protecteddefzzzB{begin{CJK*}{UTF8}{gbsn}关于数学部分end{CJK*}}
begin{document}
begin{CJK*}{UTF8}{gbsn}
section{zzzA}
section{zzzB}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
end{CJK*}
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
begin{CJK*}{UTF8}{bsmi}
這是繁體中文。
end{CJK*}
end{document}
1
Great simple solution, the macro wrapping works without the need for additional packages.
– Jankapunkt
17 hours ago
add a comment |
These days using luatex or xelatex for non latin scripts is probably recommended but you can re-assert the CJK processing so that it is in scope in the heading. Simpler to hide it in a macro so it is safe from expansion and uppercasing issues.
documentclass{article}
usepackage{CJKutf8}
usepackage{fancyhdr}
pagestyle{fancy} % <---- uncomment to throw error in compile
protecteddefzzzA{begin{CJK*}{UTF8}{gbsn}前言end{CJK*}}
protecteddefzzzB{begin{CJK*}{UTF8}{gbsn}关于数学部分end{CJK*}}
begin{document}
begin{CJK*}{UTF8}{gbsn}
section{zzzA}
section{zzzB}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
end{CJK*}
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
begin{CJK*}{UTF8}{bsmi}
這是繁體中文。
end{CJK*}
end{document}
1
Great simple solution, the macro wrapping works without the need for additional packages.
– Jankapunkt
17 hours ago
add a comment |
These days using luatex or xelatex for non latin scripts is probably recommended but you can re-assert the CJK processing so that it is in scope in the heading. Simpler to hide it in a macro so it is safe from expansion and uppercasing issues.
documentclass{article}
usepackage{CJKutf8}
usepackage{fancyhdr}
pagestyle{fancy} % <---- uncomment to throw error in compile
protecteddefzzzA{begin{CJK*}{UTF8}{gbsn}前言end{CJK*}}
protecteddefzzzB{begin{CJK*}{UTF8}{gbsn}关于数学部分end{CJK*}}
begin{document}
begin{CJK*}{UTF8}{gbsn}
section{zzzA}
section{zzzB}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
end{CJK*}
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
begin{CJK*}{UTF8}{bsmi}
這是繁體中文。
end{CJK*}
end{document}
These days using luatex or xelatex for non latin scripts is probably recommended but you can re-assert the CJK processing so that it is in scope in the heading. Simpler to hide it in a macro so it is safe from expansion and uppercasing issues.
documentclass{article}
usepackage{CJKutf8}
usepackage{fancyhdr}
pagestyle{fancy} % <---- uncomment to throw error in compile
protecteddefzzzA{begin{CJK*}{UTF8}{gbsn}前言end{CJK*}}
protecteddefzzzB{begin{CJK*}{UTF8}{gbsn}关于数学部分end{CJK*}}
begin{document}
begin{CJK*}{UTF8}{gbsn}
section{zzzA}
section{zzzB}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
end{CJK*}
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
begin{CJK*}{UTF8}{bsmi}
這是繁體中文。
end{CJK*}
end{document}
answered 17 hours ago
David CarlisleDavid Carlisle
494k4111371885
494k4111371885
1
Great simple solution, the macro wrapping works without the need for additional packages.
– Jankapunkt
17 hours ago
add a comment |
1
Great simple solution, the macro wrapping works without the need for additional packages.
– Jankapunkt
17 hours ago
1
1
Great simple solution, the macro wrapping works without the need for additional packages.
– Jankapunkt
17 hours ago
Great simple solution, the macro wrapping works without the need for additional packages.
– Jankapunkt
17 hours ago
add a comment |
If you're free to use LuaLaTeX or XeLaTeX and have a suitable system font, i.e., one which has the requisite Chinese characters, you can dispense with switching between CJK*
and "ordinary" environments.
The following example compiles equally well under both LuaLaTeX and XeLaTeX on my MacOS system, MacTeX2018, the fontspec
package, and the SimSun system font.
documentclass{article}
usepackage{fontspec} % for "setmainfont" macro
setmainfont{SimSun} % or some other suitable font
%usepackage{CJKutf8} % not needed
usepackage{fancyhdr}
pagestyle{fancy}
setlengthparindent{0pt} % just for this example
begin{document}
%begin{CJK*}{UTF8}{gbsn} % not needed
section{前言}
section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English
(Latin script) without adding extra environments.
%end{CJK*} % not needed
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
%begin{CJK*}{UTF8}{bsmi} % not needed
這是繁體中文。
%end{CJK*} % not needed
end{document}
add a comment |
If you're free to use LuaLaTeX or XeLaTeX and have a suitable system font, i.e., one which has the requisite Chinese characters, you can dispense with switching between CJK*
and "ordinary" environments.
The following example compiles equally well under both LuaLaTeX and XeLaTeX on my MacOS system, MacTeX2018, the fontspec
package, and the SimSun system font.
documentclass{article}
usepackage{fontspec} % for "setmainfont" macro
setmainfont{SimSun} % or some other suitable font
%usepackage{CJKutf8} % not needed
usepackage{fancyhdr}
pagestyle{fancy}
setlengthparindent{0pt} % just for this example
begin{document}
%begin{CJK*}{UTF8}{gbsn} % not needed
section{前言}
section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English
(Latin script) without adding extra environments.
%end{CJK*} % not needed
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
%begin{CJK*}{UTF8}{bsmi} % not needed
這是繁體中文。
%end{CJK*} % not needed
end{document}
add a comment |
If you're free to use LuaLaTeX or XeLaTeX and have a suitable system font, i.e., one which has the requisite Chinese characters, you can dispense with switching between CJK*
and "ordinary" environments.
The following example compiles equally well under both LuaLaTeX and XeLaTeX on my MacOS system, MacTeX2018, the fontspec
package, and the SimSun system font.
documentclass{article}
usepackage{fontspec} % for "setmainfont" macro
setmainfont{SimSun} % or some other suitable font
%usepackage{CJKutf8} % not needed
usepackage{fancyhdr}
pagestyle{fancy}
setlengthparindent{0pt} % just for this example
begin{document}
%begin{CJK*}{UTF8}{gbsn} % not needed
section{前言}
section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English
(Latin script) without adding extra environments.
%end{CJK*} % not needed
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
%begin{CJK*}{UTF8}{bsmi} % not needed
這是繁體中文。
%end{CJK*} % not needed
end{document}
If you're free to use LuaLaTeX or XeLaTeX and have a suitable system font, i.e., one which has the requisite Chinese characters, you can dispense with switching between CJK*
and "ordinary" environments.
The following example compiles equally well under both LuaLaTeX and XeLaTeX on my MacOS system, MacTeX2018, the fontspec
package, and the SimSun system font.
documentclass{article}
usepackage{fontspec} % for "setmainfont" macro
setmainfont{SimSun} % or some other suitable font
%usepackage{CJKutf8} % not needed
usepackage{fancyhdr}
pagestyle{fancy}
setlengthparindent{0pt} % just for this example
begin{document}
%begin{CJK*}{UTF8}{gbsn} % not needed
section{前言}
section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English
(Latin script) without adding extra environments.
%end{CJK*} % not needed
bigskip %% Just some white space
You can also insert Latin text in your document
bigskip %% Just some white space
%begin{CJK*}{UTF8}{bsmi} % not needed
這是繁體中文。
%end{CJK*} % not needed
end{document}
answered 18 hours ago
MicoMico
282k31385774
282k31385774
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478696%2fis-there-a-way-to-make-fancyhdr-with-pagestyle-fancy-to-be-compatible-with-chine%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown