TikZ in section heading
up vote
4
down vote
favorite
I am trying to include a first circled and then boxed word in a section heading.
Currently, I am only able to create this highlighted word within a normal paragraph, but not inside of a heading. My attempt so far:
documentclass[a4paper]{article}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
section{Custom fbox{word} in Section heading}
fbox{circled{word}}
end{document}
Which renders like this:
.
Ideally, I want to be able to write something similar to fbox{circled{word}}
inside of my section heading, which currently simply throws an error about the "undefined control sequence def
.
tikz-pgf sectioning
New contributor
add a comment |
up vote
4
down vote
favorite
I am trying to include a first circled and then boxed word in a section heading.
Currently, I am only able to create this highlighted word within a normal paragraph, but not inside of a heading. My attempt so far:
documentclass[a4paper]{article}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
section{Custom fbox{word} in Section heading}
fbox{circled{word}}
end{document}
Which renders like this:
.
Ideally, I want to be able to write something similar to fbox{circled{word}}
inside of my section heading, which currently simply throws an error about the "undefined control sequence def
.
tikz-pgf sectioning
New contributor
Welcome to TeX.SE!
– Kurt
4 hours ago
section{Custom fbox{protectcircled{word}} in Section heading}
also works...
– marmot
4 hours ago
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I am trying to include a first circled and then boxed word in a section heading.
Currently, I am only able to create this highlighted word within a normal paragraph, but not inside of a heading. My attempt so far:
documentclass[a4paper]{article}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
section{Custom fbox{word} in Section heading}
fbox{circled{word}}
end{document}
Which renders like this:
.
Ideally, I want to be able to write something similar to fbox{circled{word}}
inside of my section heading, which currently simply throws an error about the "undefined control sequence def
.
tikz-pgf sectioning
New contributor
I am trying to include a first circled and then boxed word in a section heading.
Currently, I am only able to create this highlighted word within a normal paragraph, but not inside of a heading. My attempt so far:
documentclass[a4paper]{article}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
section{Custom fbox{word} in Section heading}
fbox{circled{word}}
end{document}
Which renders like this:
.
Ideally, I want to be able to write something similar to fbox{circled{word}}
inside of my section heading, which currently simply throws an error about the "undefined control sequence def
.
tikz-pgf sectioning
tikz-pgf sectioning
New contributor
New contributor
New contributor
asked 4 hours ago
Sermak
211
211
New contributor
New contributor
Welcome to TeX.SE!
– Kurt
4 hours ago
section{Custom fbox{protectcircled{word}} in Section heading}
also works...
– marmot
4 hours ago
add a comment |
Welcome to TeX.SE!
– Kurt
4 hours ago
section{Custom fbox{protectcircled{word}} in Section heading}
also works...
– marmot
4 hours ago
Welcome to TeX.SE!
– Kurt
4 hours ago
Welcome to TeX.SE!
– Kurt
4 hours ago
section{Custom fbox{protectcircled{word}} in Section heading}
also works...– marmot
4 hours ago
section{Custom fbox{protectcircled{word}} in Section heading}
also works...– marmot
4 hours ago
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
This is because you command is fragile. Here is a solution:
documentclass[a4paper]{article}
usepackage{tikz}
DeclareRobustCommandcircled[1]{fbox{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}}
begin{document}
section{Custom circled{word} in Section heading}
circled{word}
end{document}
add a comment |
up vote
1
down vote
Anything inside sectioning commands must be robust or protected using protect
, so you need to change you newcommand
to DeclareRobustCommand
.
documentclass[a4paper]{article}
usepackage{tikz}
DeclareRobustCommandcircled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
section{Custom fbox{circled{word}} in Section heading}
fbox{circled{word}}
end{document}
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
This is because you command is fragile. Here is a solution:
documentclass[a4paper]{article}
usepackage{tikz}
DeclareRobustCommandcircled[1]{fbox{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}}
begin{document}
section{Custom circled{word} in Section heading}
circled{word}
end{document}
add a comment |
up vote
1
down vote
This is because you command is fragile. Here is a solution:
documentclass[a4paper]{article}
usepackage{tikz}
DeclareRobustCommandcircled[1]{fbox{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}}
begin{document}
section{Custom circled{word} in Section heading}
circled{word}
end{document}
add a comment |
up vote
1
down vote
up vote
1
down vote
This is because you command is fragile. Here is a solution:
documentclass[a4paper]{article}
usepackage{tikz}
DeclareRobustCommandcircled[1]{fbox{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}}
begin{document}
section{Custom circled{word} in Section heading}
circled{word}
end{document}
This is because you command is fragile. Here is a solution:
documentclass[a4paper]{article}
usepackage{tikz}
DeclareRobustCommandcircled[1]{fbox{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}}
begin{document}
section{Custom circled{word} in Section heading}
circled{word}
end{document}
answered 4 hours ago
Bernard
163k768192
163k768192
add a comment |
add a comment |
up vote
1
down vote
Anything inside sectioning commands must be robust or protected using protect
, so you need to change you newcommand
to DeclareRobustCommand
.
documentclass[a4paper]{article}
usepackage{tikz}
DeclareRobustCommandcircled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
section{Custom fbox{circled{word}} in Section heading}
fbox{circled{word}}
end{document}
add a comment |
up vote
1
down vote
Anything inside sectioning commands must be robust or protected using protect
, so you need to change you newcommand
to DeclareRobustCommand
.
documentclass[a4paper]{article}
usepackage{tikz}
DeclareRobustCommandcircled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
section{Custom fbox{circled{word}} in Section heading}
fbox{circled{word}}
end{document}
add a comment |
up vote
1
down vote
up vote
1
down vote
Anything inside sectioning commands must be robust or protected using protect
, so you need to change you newcommand
to DeclareRobustCommand
.
documentclass[a4paper]{article}
usepackage{tikz}
DeclareRobustCommandcircled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
section{Custom fbox{circled{word}} in Section heading}
fbox{circled{word}}
end{document}
Anything inside sectioning commands must be robust or protected using protect
, so you need to change you newcommand
to DeclareRobustCommand
.
documentclass[a4paper]{article}
usepackage{tikz}
DeclareRobustCommandcircled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
section{Custom fbox{circled{word}} in Section heading}
fbox{circled{word}}
end{document}
edited 4 hours ago
answered 4 hours ago
AboAmmar
31.7k22781
31.7k22781
add a comment |
add a comment |
Sermak is a new contributor. Be nice, and check out our Code of Conduct.
Sermak is a new contributor. Be nice, and check out our Code of Conduct.
Sermak is a new contributor. Be nice, and check out our Code of Conduct.
Sermak is a new contributor. Be nice, and check out our Code of Conduct.
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.
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%2f463233%2ftikz-in-section-heading%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
Welcome to TeX.SE!
– Kurt
4 hours ago
section{Custom fbox{protectcircled{word}} in Section heading}
also works...– marmot
4 hours ago