Make soul and texttt work together
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I was trying to redefine texttt
command to make it have background color using package soul. But it seems that it is harder than I thought.
My initial code is
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
renewcommandtexttt[1]
hloldtexttt#1
begindocument
textttcan we highlight
enddocument
But it won't run, the error message is:
Argument of texttt has an extra }.
I searched and found this post. The post suggests to use soulregister
command. So I add the following line before begindocument
:
soulregistertexttt1
But the error persists. I also found this post, which further suggests to use DeclareRobustCommand
. Now my code is
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
% renewcommandtexttt[1]
% hloldtexttt#1
%
DeclareRobustCommandtexttt[1]
hloldtexttt#1
soulregistertexttt1
begindocument
textttcan we highlight
enddocument
But it doesn't work. The error message is
TeX capacity exceeded, sorry [grouping levels=255]
It seems like rabbit hole of issues. Can you point out what has gone wrong? How to fix this seemingly simple problem?
Edit:
I am using Pandoc to convert Markdown file to PDF. The underlying LaTeX command for Markdown inline code is texttt
. But there is no background color. That is why I want to combine soul and texttt
.
I have tried the solution of @egreg and @daleif. They both work for standard alone tex code.
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
% renewcommandtexttt[1]
% ttfamilyhl#1
%
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
begindocument
textttcan we highlight
enddocument
But if I put it in a file head.tex
and compile Markdown to PDF, there are still errors. The content of head.tex
is:
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
Content of test.md
is
`some inline words`
If I try to generate PDF using the new header:
pandoc -H head.tex -s test.md -o test.pdf
there occurs another error:
Package soul Error: Reconstruction failed.
typewriter soul
add a comment |Â
up vote
3
down vote
favorite
I was trying to redefine texttt
command to make it have background color using package soul. But it seems that it is harder than I thought.
My initial code is
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
renewcommandtexttt[1]
hloldtexttt#1
begindocument
textttcan we highlight
enddocument
But it won't run, the error message is:
Argument of texttt has an extra }.
I searched and found this post. The post suggests to use soulregister
command. So I add the following line before begindocument
:
soulregistertexttt1
But the error persists. I also found this post, which further suggests to use DeclareRobustCommand
. Now my code is
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
% renewcommandtexttt[1]
% hloldtexttt#1
%
DeclareRobustCommandtexttt[1]
hloldtexttt#1
soulregistertexttt1
begindocument
textttcan we highlight
enddocument
But it doesn't work. The error message is
TeX capacity exceeded, sorry [grouping levels=255]
It seems like rabbit hole of issues. Can you point out what has gone wrong? How to fix this seemingly simple problem?
Edit:
I am using Pandoc to convert Markdown file to PDF. The underlying LaTeX command for Markdown inline code is texttt
. But there is no background color. That is why I want to combine soul and texttt
.
I have tried the solution of @egreg and @daleif. They both work for standard alone tex code.
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
% renewcommandtexttt[1]
% ttfamilyhl#1
%
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
begindocument
textttcan we highlight
enddocument
But if I put it in a file head.tex
and compile Markdown to PDF, there are still errors. The content of head.tex
is:
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
Content of test.md
is
`some inline words`
If I try to generate PDF using the new header:
pandoc -H head.tex -s test.md -o test.pdf
there occurs another error:
Package soul Error: Reconstruction failed.
typewriter soul
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I was trying to redefine texttt
command to make it have background color using package soul. But it seems that it is harder than I thought.
My initial code is
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
renewcommandtexttt[1]
hloldtexttt#1
begindocument
textttcan we highlight
enddocument
But it won't run, the error message is:
Argument of texttt has an extra }.
I searched and found this post. The post suggests to use soulregister
command. So I add the following line before begindocument
:
soulregistertexttt1
But the error persists. I also found this post, which further suggests to use DeclareRobustCommand
. Now my code is
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
% renewcommandtexttt[1]
% hloldtexttt#1
%
DeclareRobustCommandtexttt[1]
hloldtexttt#1
soulregistertexttt1
begindocument
textttcan we highlight
enddocument
But it doesn't work. The error message is
TeX capacity exceeded, sorry [grouping levels=255]
It seems like rabbit hole of issues. Can you point out what has gone wrong? How to fix this seemingly simple problem?
Edit:
I am using Pandoc to convert Markdown file to PDF. The underlying LaTeX command for Markdown inline code is texttt
. But there is no background color. That is why I want to combine soul and texttt
.
I have tried the solution of @egreg and @daleif. They both work for standard alone tex code.
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
% renewcommandtexttt[1]
% ttfamilyhl#1
%
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
begindocument
textttcan we highlight
enddocument
But if I put it in a file head.tex
and compile Markdown to PDF, there are still errors. The content of head.tex
is:
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
Content of test.md
is
`some inline words`
If I try to generate PDF using the new header:
pandoc -H head.tex -s test.md -o test.pdf
there occurs another error:
Package soul Error: Reconstruction failed.
typewriter soul
I was trying to redefine texttt
command to make it have background color using package soul. But it seems that it is harder than I thought.
My initial code is
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
renewcommandtexttt[1]
hloldtexttt#1
begindocument
textttcan we highlight
enddocument
But it won't run, the error message is:
Argument of texttt has an extra }.
I searched and found this post. The post suggests to use soulregister
command. So I add the following line before begindocument
:
soulregistertexttt1
But the error persists. I also found this post, which further suggests to use DeclareRobustCommand
. Now my code is
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
% renewcommandtexttt[1]
% hloldtexttt#1
%
DeclareRobustCommandtexttt[1]
hloldtexttt#1
soulregistertexttt1
begindocument
textttcan we highlight
enddocument
But it doesn't work. The error message is
TeX capacity exceeded, sorry [grouping levels=255]
It seems like rabbit hole of issues. Can you point out what has gone wrong? How to fix this seemingly simple problem?
Edit:
I am using Pandoc to convert Markdown file to PDF. The underlying LaTeX command for Markdown inline code is texttt
. But there is no background color. That is why I want to combine soul and texttt
.
I have tried the solution of @egreg and @daleif. They both work for standard alone tex code.
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
% renewcommandtexttt[1]
% ttfamilyhl#1
%
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
begindocument
textttcan we highlight
enddocument
But if I put it in a file head.tex
and compile Markdown to PDF, there are still errors. The content of head.tex
is:
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
letoldtexttttexttt
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
Content of test.md
is
`some inline words`
If I try to generate PDF using the new header:
pandoc -H head.tex -s test.md -o test.pdf
there occurs another error:
Package soul Error: Reconstruction failed.
typewriter soul
typewriter soul
edited Sep 4 at 9:17
asked Sep 4 at 8:22
jdhao
334114
334114
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
5
down vote
The soul
macros are rather special, it works on a macro level this cannot handle that the contents has "macros" in it.
I would not overload texttt
like that, make a special macro for it.
BTW: This works ttfamilyhl#1
add a comment |Â
up vote
1
down vote
The working of texttt
is essentially absorbing its argument and issuing ttfamily
.
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
begindocument
textttcan we highlight
enddocument
On the other hand, it would be better to use a different command:
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
DeclareRobustCommandhltt[1]%
hlttfamily#1%
begindocument
hlttcan we highlight
enddocument
Don't forget to protect the end-of-lines.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
The soul
macros are rather special, it works on a macro level this cannot handle that the contents has "macros" in it.
I would not overload texttt
like that, make a special macro for it.
BTW: This works ttfamilyhl#1
add a comment |Â
up vote
5
down vote
The soul
macros are rather special, it works on a macro level this cannot handle that the contents has "macros" in it.
I would not overload texttt
like that, make a special macro for it.
BTW: This works ttfamilyhl#1
add a comment |Â
up vote
5
down vote
up vote
5
down vote
The soul
macros are rather special, it works on a macro level this cannot handle that the contents has "macros" in it.
I would not overload texttt
like that, make a special macro for it.
BTW: This works ttfamilyhl#1
The soul
macros are rather special, it works on a macro level this cannot handle that the contents has "macros" in it.
I would not overload texttt
like that, make a special macro for it.
BTW: This works ttfamilyhl#1
answered Sep 4 at 8:38
daleif
31.3k247108
31.3k247108
add a comment |Â
add a comment |Â
up vote
1
down vote
The working of texttt
is essentially absorbing its argument and issuing ttfamily
.
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
begindocument
textttcan we highlight
enddocument
On the other hand, it would be better to use a different command:
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
DeclareRobustCommandhltt[1]%
hlttfamily#1%
begindocument
hlttcan we highlight
enddocument
Don't forget to protect the end-of-lines.
add a comment |Â
up vote
1
down vote
The working of texttt
is essentially absorbing its argument and issuing ttfamily
.
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
begindocument
textttcan we highlight
enddocument
On the other hand, it would be better to use a different command:
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
DeclareRobustCommandhltt[1]%
hlttfamily#1%
begindocument
hlttcan we highlight
enddocument
Don't forget to protect the end-of-lines.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
The working of texttt
is essentially absorbing its argument and issuing ttfamily
.
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
begindocument
textttcan we highlight
enddocument
On the other hand, it would be better to use a different command:
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
DeclareRobustCommandhltt[1]%
hlttfamily#1%
begindocument
hlttcan we highlight
enddocument
Don't forget to protect the end-of-lines.
The working of texttt
is essentially absorbing its argument and issuing ttfamily
.
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
DeclareRobustCommandtexttt[1]%
hlttfamily#1%
begindocument
textttcan we highlight
enddocument
On the other hand, it would be better to use a different command:
documentclassarticle
usepackagexcolor, soul
colorletmycolorred!30
sethlcolormycolor
DeclareRobustCommandhltt[1]%
hlttfamily#1%
begindocument
hlttcan we highlight
enddocument
Don't forget to protect the end-of-lines.
answered Sep 4 at 8:47
egreg
682k8318183064
682k8318183064
add a comment |Â
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f449224%2fmake-soul-and-texttt-work-together%23new-answer', 'question_page');
);
Post as a guest
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
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
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