TikZ in section heading
up vote
5
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
5
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
Dec 4 at 23:17
section{Custom fbox{protectcircled{word}} in Section heading}
also works...
– marmot
Dec 4 at 23:40
@Sermak Are you using hyperref in your real document?
– samcarter
yesterday
add a comment |
up vote
5
down vote
favorite
up vote
5
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 Dec 4 at 23:05
Sermak
261
261
New contributor
New contributor
Welcome to TeX.SE!
– Kurt
Dec 4 at 23:17
section{Custom fbox{protectcircled{word}} in Section heading}
also works...
– marmot
Dec 4 at 23:40
@Sermak Are you using hyperref in your real document?
– samcarter
yesterday
add a comment |
Welcome to TeX.SE!
– Kurt
Dec 4 at 23:17
section{Custom fbox{protectcircled{word}} in Section heading}
also works...
– marmot
Dec 4 at 23:40
@Sermak Are you using hyperref in your real document?
– samcarter
yesterday
Welcome to TeX.SE!
– Kurt
Dec 4 at 23:17
Welcome to TeX.SE!
– Kurt
Dec 4 at 23:17
section{Custom fbox{protectcircled{word}} in Section heading}
also works...– marmot
Dec 4 at 23:40
section{Custom fbox{protectcircled{word}} in Section heading}
also works...– marmot
Dec 4 at 23:40
@Sermak Are you using hyperref in your real document?
– samcarter
yesterday
@Sermak Are you using hyperref in your real document?
– samcarter
yesterday
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
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
2
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
2
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
2
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
2
down vote
up vote
2
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 Dec 4 at 23:36
Bernard
163k769192
163k769192
add a comment |
add a comment |
up vote
2
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
2
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
2
down vote
up vote
2
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 Dec 4 at 23:41
answered Dec 4 at 23:36
AboAmmar
31.8k22781
31.8k22781
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
Dec 4 at 23:17
section{Custom fbox{protectcircled{word}} in Section heading}
also works...– marmot
Dec 4 at 23:40
@Sermak Are you using hyperref in your real document?
– samcarter
yesterday