How to underline CJK with soul?











up vote
1
down vote

favorite












I was using soul to underline text.
It works until I tried to underline some CJK text.



When I have



def mytest {测试test very long text blah blah blah ...}
ulmytest


in the document, it complains:
Package soul Error: Reconstruction failed.



I also tried CJKunderline. But it does not auto-wrap for this long text.










share|improve this question






















  • There is ctan.org/pkg/soulutf8, which might help (I didn't test). Do you use pdfLaTeX, LuaLaTeX or XeLaTeX? But as always: Underlining is hard in TeX and soul as well as ulem have restrictions in what their underlining macros can accept as input. It may well be that neither can accept CJK characters without exploding. You already know about Paul Isambert's LuaLaTeX underlining code that should work here (again I didn't test), but of course requires LuaLaTeX (tex.stackexchange.com/q/435962/35864).
    – moewe
    Nov 27 at 7:21










  • I tried soulutf8, with XeLaTeX. And It does not help. But thank you for your suggestion.
    – jiewuza
    Nov 28 at 9:53















up vote
1
down vote

favorite












I was using soul to underline text.
It works until I tried to underline some CJK text.



When I have



def mytest {测试test very long text blah blah blah ...}
ulmytest


in the document, it complains:
Package soul Error: Reconstruction failed.



I also tried CJKunderline. But it does not auto-wrap for this long text.










share|improve this question






















  • There is ctan.org/pkg/soulutf8, which might help (I didn't test). Do you use pdfLaTeX, LuaLaTeX or XeLaTeX? But as always: Underlining is hard in TeX and soul as well as ulem have restrictions in what their underlining macros can accept as input. It may well be that neither can accept CJK characters without exploding. You already know about Paul Isambert's LuaLaTeX underlining code that should work here (again I didn't test), but of course requires LuaLaTeX (tex.stackexchange.com/q/435962/35864).
    – moewe
    Nov 27 at 7:21










  • I tried soulutf8, with XeLaTeX. And It does not help. But thank you for your suggestion.
    – jiewuza
    Nov 28 at 9:53













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I was using soul to underline text.
It works until I tried to underline some CJK text.



When I have



def mytest {测试test very long text blah blah blah ...}
ulmytest


in the document, it complains:
Package soul Error: Reconstruction failed.



I also tried CJKunderline. But it does not auto-wrap for this long text.










share|improve this question













I was using soul to underline text.
It works until I tried to underline some CJK text.



When I have



def mytest {测试test very long text blah blah blah ...}
ulmytest


in the document, it complains:
Package soul Error: Reconstruction failed.



I also tried CJKunderline. But it does not auto-wrap for this long text.







cjk soul underline






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 27 at 6:51









jiewuza

506




506












  • There is ctan.org/pkg/soulutf8, which might help (I didn't test). Do you use pdfLaTeX, LuaLaTeX or XeLaTeX? But as always: Underlining is hard in TeX and soul as well as ulem have restrictions in what their underlining macros can accept as input. It may well be that neither can accept CJK characters without exploding. You already know about Paul Isambert's LuaLaTeX underlining code that should work here (again I didn't test), but of course requires LuaLaTeX (tex.stackexchange.com/q/435962/35864).
    – moewe
    Nov 27 at 7:21










  • I tried soulutf8, with XeLaTeX. And It does not help. But thank you for your suggestion.
    – jiewuza
    Nov 28 at 9:53


















  • There is ctan.org/pkg/soulutf8, which might help (I didn't test). Do you use pdfLaTeX, LuaLaTeX or XeLaTeX? But as always: Underlining is hard in TeX and soul as well as ulem have restrictions in what their underlining macros can accept as input. It may well be that neither can accept CJK characters without exploding. You already know about Paul Isambert's LuaLaTeX underlining code that should work here (again I didn't test), but of course requires LuaLaTeX (tex.stackexchange.com/q/435962/35864).
    – moewe
    Nov 27 at 7:21










  • I tried soulutf8, with XeLaTeX. And It does not help. But thank you for your suggestion.
    – jiewuza
    Nov 28 at 9:53
















There is ctan.org/pkg/soulutf8, which might help (I didn't test). Do you use pdfLaTeX, LuaLaTeX or XeLaTeX? But as always: Underlining is hard in TeX and soul as well as ulem have restrictions in what their underlining macros can accept as input. It may well be that neither can accept CJK characters without exploding. You already know about Paul Isambert's LuaLaTeX underlining code that should work here (again I didn't test), but of course requires LuaLaTeX (tex.stackexchange.com/q/435962/35864).
– moewe
Nov 27 at 7:21




There is ctan.org/pkg/soulutf8, which might help (I didn't test). Do you use pdfLaTeX, LuaLaTeX or XeLaTeX? But as always: Underlining is hard in TeX and soul as well as ulem have restrictions in what their underlining macros can accept as input. It may well be that neither can accept CJK characters without exploding. You already know about Paul Isambert's LuaLaTeX underlining code that should work here (again I didn't test), but of course requires LuaLaTeX (tex.stackexchange.com/q/435962/35864).
– moewe
Nov 27 at 7:21












I tried soulutf8, with XeLaTeX. And It does not help. But thank you for your suggestion.
– jiewuza
Nov 28 at 9:53




I tried soulutf8, with XeLaTeX. And It does not help. But thank you for your suggestion.
– jiewuza
Nov 28 at 9:53










1 Answer
1






active

oldest

votes

















up vote
1
down vote













Run the document with xelatex or lualatex:



documentclass{article}
usepackage{fontspec}
setmainfont{Noto Sans CJK JP}
usepackage{soul}
begin{document}
def mytest {测试test very long text blah blah blah ...}
ulmytest
end{document}


enter image description here






share|improve this answer





















  • I have usepackage{xeCJK} after usepackage{fontspec}, and the same complain remains.
    – jiewuza
    Nov 28 at 9:51










  • I checked the document of xeCJK. It uses fontspec inside. I doubt soul is not compatible with xeCJK.
    – jiewuza
    Nov 28 at 10:12










  • yes, seems so. It is the way how xeCJK redefines character setting
    – Herbert
    Nov 28 at 10:23










  • Well, I guess I cannot get rid of xeCJK. I use it to set font.
    – jiewuza
    Nov 28 at 10:48












  • fontsetting can also be done with fontspec. But I am not an CJK expert ...
    – Herbert
    Nov 28 at 11:15











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',
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461957%2fhow-to-underline-cjk-with-soul%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













Run the document with xelatex or lualatex:



documentclass{article}
usepackage{fontspec}
setmainfont{Noto Sans CJK JP}
usepackage{soul}
begin{document}
def mytest {测试test very long text blah blah blah ...}
ulmytest
end{document}


enter image description here






share|improve this answer





















  • I have usepackage{xeCJK} after usepackage{fontspec}, and the same complain remains.
    – jiewuza
    Nov 28 at 9:51










  • I checked the document of xeCJK. It uses fontspec inside. I doubt soul is not compatible with xeCJK.
    – jiewuza
    Nov 28 at 10:12










  • yes, seems so. It is the way how xeCJK redefines character setting
    – Herbert
    Nov 28 at 10:23










  • Well, I guess I cannot get rid of xeCJK. I use it to set font.
    – jiewuza
    Nov 28 at 10:48












  • fontsetting can also be done with fontspec. But I am not an CJK expert ...
    – Herbert
    Nov 28 at 11:15















up vote
1
down vote













Run the document with xelatex or lualatex:



documentclass{article}
usepackage{fontspec}
setmainfont{Noto Sans CJK JP}
usepackage{soul}
begin{document}
def mytest {测试test very long text blah blah blah ...}
ulmytest
end{document}


enter image description here






share|improve this answer





















  • I have usepackage{xeCJK} after usepackage{fontspec}, and the same complain remains.
    – jiewuza
    Nov 28 at 9:51










  • I checked the document of xeCJK. It uses fontspec inside. I doubt soul is not compatible with xeCJK.
    – jiewuza
    Nov 28 at 10:12










  • yes, seems so. It is the way how xeCJK redefines character setting
    – Herbert
    Nov 28 at 10:23










  • Well, I guess I cannot get rid of xeCJK. I use it to set font.
    – jiewuza
    Nov 28 at 10:48












  • fontsetting can also be done with fontspec. But I am not an CJK expert ...
    – Herbert
    Nov 28 at 11:15













up vote
1
down vote










up vote
1
down vote









Run the document with xelatex or lualatex:



documentclass{article}
usepackage{fontspec}
setmainfont{Noto Sans CJK JP}
usepackage{soul}
begin{document}
def mytest {测试test very long text blah blah blah ...}
ulmytest
end{document}


enter image description here






share|improve this answer












Run the document with xelatex or lualatex:



documentclass{article}
usepackage{fontspec}
setmainfont{Noto Sans CJK JP}
usepackage{soul}
begin{document}
def mytest {测试test very long text blah blah blah ...}
ulmytest
end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 27 at 8:03









Herbert

266k23405716




266k23405716












  • I have usepackage{xeCJK} after usepackage{fontspec}, and the same complain remains.
    – jiewuza
    Nov 28 at 9:51










  • I checked the document of xeCJK. It uses fontspec inside. I doubt soul is not compatible with xeCJK.
    – jiewuza
    Nov 28 at 10:12










  • yes, seems so. It is the way how xeCJK redefines character setting
    – Herbert
    Nov 28 at 10:23










  • Well, I guess I cannot get rid of xeCJK. I use it to set font.
    – jiewuza
    Nov 28 at 10:48












  • fontsetting can also be done with fontspec. But I am not an CJK expert ...
    – Herbert
    Nov 28 at 11:15


















  • I have usepackage{xeCJK} after usepackage{fontspec}, and the same complain remains.
    – jiewuza
    Nov 28 at 9:51










  • I checked the document of xeCJK. It uses fontspec inside. I doubt soul is not compatible with xeCJK.
    – jiewuza
    Nov 28 at 10:12










  • yes, seems so. It is the way how xeCJK redefines character setting
    – Herbert
    Nov 28 at 10:23










  • Well, I guess I cannot get rid of xeCJK. I use it to set font.
    – jiewuza
    Nov 28 at 10:48












  • fontsetting can also be done with fontspec. But I am not an CJK expert ...
    – Herbert
    Nov 28 at 11:15
















I have usepackage{xeCJK} after usepackage{fontspec}, and the same complain remains.
– jiewuza
Nov 28 at 9:51




I have usepackage{xeCJK} after usepackage{fontspec}, and the same complain remains.
– jiewuza
Nov 28 at 9:51












I checked the document of xeCJK. It uses fontspec inside. I doubt soul is not compatible with xeCJK.
– jiewuza
Nov 28 at 10:12




I checked the document of xeCJK. It uses fontspec inside. I doubt soul is not compatible with xeCJK.
– jiewuza
Nov 28 at 10:12












yes, seems so. It is the way how xeCJK redefines character setting
– Herbert
Nov 28 at 10:23




yes, seems so. It is the way how xeCJK redefines character setting
– Herbert
Nov 28 at 10:23












Well, I guess I cannot get rid of xeCJK. I use it to set font.
– jiewuza
Nov 28 at 10:48






Well, I guess I cannot get rid of xeCJK. I use it to set font.
– jiewuza
Nov 28 at 10:48














fontsetting can also be done with fontspec. But I am not an CJK expert ...
– Herbert
Nov 28 at 11:15




fontsetting can also be done with fontspec. But I am not an CJK expert ...
– Herbert
Nov 28 at 11:15


















draft saved

draft discarded




















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461957%2fhow-to-underline-cjk-with-soul%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?