Label blocks inlcuding section number
up vote
4
down vote
favorite
I want to add section number when referencing blocks. MWE is as follows:
documentclass[serif,12pt,xcolor=dvipsnames]{beamer}
usetheme{Madrid}
usepackage{lipsum}
begin{document}
begin{frame}{Example ref{block1}}
section{}
begin{block}{}label{block1}
lipsum[2]
end{block}
end{frame}
end{document}
This is what I have at the moment:
But I would like to have the following:
Many thanks in advance!
beamer cross-referencing numbering
New contributor
|
show 1 more comment
up vote
4
down vote
favorite
I want to add section number when referencing blocks. MWE is as follows:
documentclass[serif,12pt,xcolor=dvipsnames]{beamer}
usetheme{Madrid}
usepackage{lipsum}
begin{document}
begin{frame}{Example ref{block1}}
section{}
begin{block}{}label{block1}
lipsum[2]
end{block}
end{frame}
end{document}
This is what I have at the moment:
But I would like to have the following:
Many thanks in advance!
beamer cross-referencing numbering
New contributor
Trydocumentclass[serif,12pt,xcolor=dvipsnames]{beamer} usetheme{Madrid} usepackage{lipsum} begin{document} section{A section} begin{frame}{Example arabic{section}.ref{block1}} begin{block}{}label{block1} lipsum[2] end{block} end{frame} end{document}
– marmot
Nov 20 at 19:31
Many thanks @marmot, it works! I was wondering if there is a way to automatically include section number without having to type the section number in front ofref{block1}
every time.
– Alex
Nov 20 at 19:50
1
Of course, there is e.g. thenumberwithin
command that AFAIK comes with amsmath. That is, you need to declare your example to be a "theorem-like" environment that and then saynumberwithin{example}{section}
. I guess a reasonable starting point would be this answer and saynumberwithin{theorem}{section}
instead. Of course, it will be better to wait till @samcarter sees this question and gives a real answer. ;-)
– marmot
Nov 20 at 19:57
I think the main problem is that blocks are not numbered and if you label them, you will get the framenumber. So your document above only works by chance. I'll see if I can add counters to the blocks.
– samcarter
Nov 20 at 20:07
1
@marmot For someone who claims that his crystal ball is missing, you are remarkably good at predicting the future... :)
– samcarter
Nov 20 at 20:18
|
show 1 more comment
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I want to add section number when referencing blocks. MWE is as follows:
documentclass[serif,12pt,xcolor=dvipsnames]{beamer}
usetheme{Madrid}
usepackage{lipsum}
begin{document}
begin{frame}{Example ref{block1}}
section{}
begin{block}{}label{block1}
lipsum[2]
end{block}
end{frame}
end{document}
This is what I have at the moment:
But I would like to have the following:
Many thanks in advance!
beamer cross-referencing numbering
New contributor
I want to add section number when referencing blocks. MWE is as follows:
documentclass[serif,12pt,xcolor=dvipsnames]{beamer}
usetheme{Madrid}
usepackage{lipsum}
begin{document}
begin{frame}{Example ref{block1}}
section{}
begin{block}{}label{block1}
lipsum[2]
end{block}
end{frame}
end{document}
This is what I have at the moment:
But I would like to have the following:
Many thanks in advance!
beamer cross-referencing numbering
beamer cross-referencing numbering
New contributor
New contributor
edited Nov 20 at 19:29
New contributor
asked Nov 20 at 19:08
Alex
233
233
New contributor
New contributor
Trydocumentclass[serif,12pt,xcolor=dvipsnames]{beamer} usetheme{Madrid} usepackage{lipsum} begin{document} section{A section} begin{frame}{Example arabic{section}.ref{block1}} begin{block}{}label{block1} lipsum[2] end{block} end{frame} end{document}
– marmot
Nov 20 at 19:31
Many thanks @marmot, it works! I was wondering if there is a way to automatically include section number without having to type the section number in front ofref{block1}
every time.
– Alex
Nov 20 at 19:50
1
Of course, there is e.g. thenumberwithin
command that AFAIK comes with amsmath. That is, you need to declare your example to be a "theorem-like" environment that and then saynumberwithin{example}{section}
. I guess a reasonable starting point would be this answer and saynumberwithin{theorem}{section}
instead. Of course, it will be better to wait till @samcarter sees this question and gives a real answer. ;-)
– marmot
Nov 20 at 19:57
I think the main problem is that blocks are not numbered and if you label them, you will get the framenumber. So your document above only works by chance. I'll see if I can add counters to the blocks.
– samcarter
Nov 20 at 20:07
1
@marmot For someone who claims that his crystal ball is missing, you are remarkably good at predicting the future... :)
– samcarter
Nov 20 at 20:18
|
show 1 more comment
Trydocumentclass[serif,12pt,xcolor=dvipsnames]{beamer} usetheme{Madrid} usepackage{lipsum} begin{document} section{A section} begin{frame}{Example arabic{section}.ref{block1}} begin{block}{}label{block1} lipsum[2] end{block} end{frame} end{document}
– marmot
Nov 20 at 19:31
Many thanks @marmot, it works! I was wondering if there is a way to automatically include section number without having to type the section number in front ofref{block1}
every time.
– Alex
Nov 20 at 19:50
1
Of course, there is e.g. thenumberwithin
command that AFAIK comes with amsmath. That is, you need to declare your example to be a "theorem-like" environment that and then saynumberwithin{example}{section}
. I guess a reasonable starting point would be this answer and saynumberwithin{theorem}{section}
instead. Of course, it will be better to wait till @samcarter sees this question and gives a real answer. ;-)
– marmot
Nov 20 at 19:57
I think the main problem is that blocks are not numbered and if you label them, you will get the framenumber. So your document above only works by chance. I'll see if I can add counters to the blocks.
– samcarter
Nov 20 at 20:07
1
@marmot For someone who claims that his crystal ball is missing, you are remarkably good at predicting the future... :)
– samcarter
Nov 20 at 20:18
Try
documentclass[serif,12pt,xcolor=dvipsnames]{beamer} usetheme{Madrid} usepackage{lipsum} begin{document} section{A section} begin{frame}{Example arabic{section}.ref{block1}} begin{block}{}label{block1} lipsum[2] end{block} end{frame} end{document}
– marmot
Nov 20 at 19:31
Try
documentclass[serif,12pt,xcolor=dvipsnames]{beamer} usetheme{Madrid} usepackage{lipsum} begin{document} section{A section} begin{frame}{Example arabic{section}.ref{block1}} begin{block}{}label{block1} lipsum[2] end{block} end{frame} end{document}
– marmot
Nov 20 at 19:31
Many thanks @marmot, it works! I was wondering if there is a way to automatically include section number without having to type the section number in front of
ref{block1}
every time.– Alex
Nov 20 at 19:50
Many thanks @marmot, it works! I was wondering if there is a way to automatically include section number without having to type the section number in front of
ref{block1}
every time.– Alex
Nov 20 at 19:50
1
1
Of course, there is e.g. the
numberwithin
command that AFAIK comes with amsmath. That is, you need to declare your example to be a "theorem-like" environment that and then say numberwithin{example}{section}
. I guess a reasonable starting point would be this answer and say numberwithin{theorem}{section}
instead. Of course, it will be better to wait till @samcarter sees this question and gives a real answer. ;-)– marmot
Nov 20 at 19:57
Of course, there is e.g. the
numberwithin
command that AFAIK comes with amsmath. That is, you need to declare your example to be a "theorem-like" environment that and then say numberwithin{example}{section}
. I guess a reasonable starting point would be this answer and say numberwithin{theorem}{section}
instead. Of course, it will be better to wait till @samcarter sees this question and gives a real answer. ;-)– marmot
Nov 20 at 19:57
I think the main problem is that blocks are not numbered and if you label them, you will get the framenumber. So your document above only works by chance. I'll see if I can add counters to the blocks.
– samcarter
Nov 20 at 20:07
I think the main problem is that blocks are not numbered and if you label them, you will get the framenumber. So your document above only works by chance. I'll see if I can add counters to the blocks.
– samcarter
Nov 20 at 20:07
1
1
@marmot For someone who claims that his crystal ball is missing, you are remarkably good at predicting the future... :)
– samcarter
Nov 20 at 20:18
@marmot For someone who claims that his crystal ball is missing, you are remarkably good at predicting the future... :)
– samcarter
Nov 20 at 20:18
|
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
4
down vote
accepted
The problem is actually more tricky than you make it look. The main problem is that blocks are not numbered in beamer and if you label them, you will get the framenumber and not the number of the block.
You can modify the definition of the block environment to include a counter. Once blocks are numbered you can use @marmots great suggestion and use numberwithin{block}{section}
to include the section number.
Additional comment: never ever use section
inside a frame, this can have serve side-effects.
documentclass[12pt,xcolor=dvipsnames]{beamer}
usefonttheme{serif}
usetheme{Madrid}
usepackage{lipsum}
newcounter{block}
setcounter{block}{0}
numberwithin{block}{section}
setbeamertemplate{block begin}
{%
refstepcounter{block}%
parvskipmedskipamount%
begin{beamerboxesrounded}[upper=block title,lower=block body,shadow=true]%
{raggedrightusebeamerfont*{block title}insertblocktitle}%
raggedright%
usebeamerfont{block body}%
}
begin{document}
section{}
begin{frame}{Example ref{block1}}
begin{block}{}label{block1}
lipsum[2]
end{block}
end{frame}
begin{frame}
content...
end{frame}
begin{frame}{Example ref{block2}}
begin{block}{}label{block2}
lipsum[2]
end{block}
end{frame}
end{document}
Wow, many thanks @samcarter! This is exactly what I had in mind! That's amazing!
– Alex
Nov 20 at 20:14
@Alex You're welcome!
– samcarter
Nov 20 at 20:19
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
The problem is actually more tricky than you make it look. The main problem is that blocks are not numbered in beamer and if you label them, you will get the framenumber and not the number of the block.
You can modify the definition of the block environment to include a counter. Once blocks are numbered you can use @marmots great suggestion and use numberwithin{block}{section}
to include the section number.
Additional comment: never ever use section
inside a frame, this can have serve side-effects.
documentclass[12pt,xcolor=dvipsnames]{beamer}
usefonttheme{serif}
usetheme{Madrid}
usepackage{lipsum}
newcounter{block}
setcounter{block}{0}
numberwithin{block}{section}
setbeamertemplate{block begin}
{%
refstepcounter{block}%
parvskipmedskipamount%
begin{beamerboxesrounded}[upper=block title,lower=block body,shadow=true]%
{raggedrightusebeamerfont*{block title}insertblocktitle}%
raggedright%
usebeamerfont{block body}%
}
begin{document}
section{}
begin{frame}{Example ref{block1}}
begin{block}{}label{block1}
lipsum[2]
end{block}
end{frame}
begin{frame}
content...
end{frame}
begin{frame}{Example ref{block2}}
begin{block}{}label{block2}
lipsum[2]
end{block}
end{frame}
end{document}
Wow, many thanks @samcarter! This is exactly what I had in mind! That's amazing!
– Alex
Nov 20 at 20:14
@Alex You're welcome!
– samcarter
Nov 20 at 20:19
add a comment |
up vote
4
down vote
accepted
The problem is actually more tricky than you make it look. The main problem is that blocks are not numbered in beamer and if you label them, you will get the framenumber and not the number of the block.
You can modify the definition of the block environment to include a counter. Once blocks are numbered you can use @marmots great suggestion and use numberwithin{block}{section}
to include the section number.
Additional comment: never ever use section
inside a frame, this can have serve side-effects.
documentclass[12pt,xcolor=dvipsnames]{beamer}
usefonttheme{serif}
usetheme{Madrid}
usepackage{lipsum}
newcounter{block}
setcounter{block}{0}
numberwithin{block}{section}
setbeamertemplate{block begin}
{%
refstepcounter{block}%
parvskipmedskipamount%
begin{beamerboxesrounded}[upper=block title,lower=block body,shadow=true]%
{raggedrightusebeamerfont*{block title}insertblocktitle}%
raggedright%
usebeamerfont{block body}%
}
begin{document}
section{}
begin{frame}{Example ref{block1}}
begin{block}{}label{block1}
lipsum[2]
end{block}
end{frame}
begin{frame}
content...
end{frame}
begin{frame}{Example ref{block2}}
begin{block}{}label{block2}
lipsum[2]
end{block}
end{frame}
end{document}
Wow, many thanks @samcarter! This is exactly what I had in mind! That's amazing!
– Alex
Nov 20 at 20:14
@Alex You're welcome!
– samcarter
Nov 20 at 20:19
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
The problem is actually more tricky than you make it look. The main problem is that blocks are not numbered in beamer and if you label them, you will get the framenumber and not the number of the block.
You can modify the definition of the block environment to include a counter. Once blocks are numbered you can use @marmots great suggestion and use numberwithin{block}{section}
to include the section number.
Additional comment: never ever use section
inside a frame, this can have serve side-effects.
documentclass[12pt,xcolor=dvipsnames]{beamer}
usefonttheme{serif}
usetheme{Madrid}
usepackage{lipsum}
newcounter{block}
setcounter{block}{0}
numberwithin{block}{section}
setbeamertemplate{block begin}
{%
refstepcounter{block}%
parvskipmedskipamount%
begin{beamerboxesrounded}[upper=block title,lower=block body,shadow=true]%
{raggedrightusebeamerfont*{block title}insertblocktitle}%
raggedright%
usebeamerfont{block body}%
}
begin{document}
section{}
begin{frame}{Example ref{block1}}
begin{block}{}label{block1}
lipsum[2]
end{block}
end{frame}
begin{frame}
content...
end{frame}
begin{frame}{Example ref{block2}}
begin{block}{}label{block2}
lipsum[2]
end{block}
end{frame}
end{document}
The problem is actually more tricky than you make it look. The main problem is that blocks are not numbered in beamer and if you label them, you will get the framenumber and not the number of the block.
You can modify the definition of the block environment to include a counter. Once blocks are numbered you can use @marmots great suggestion and use numberwithin{block}{section}
to include the section number.
Additional comment: never ever use section
inside a frame, this can have serve side-effects.
documentclass[12pt,xcolor=dvipsnames]{beamer}
usefonttheme{serif}
usetheme{Madrid}
usepackage{lipsum}
newcounter{block}
setcounter{block}{0}
numberwithin{block}{section}
setbeamertemplate{block begin}
{%
refstepcounter{block}%
parvskipmedskipamount%
begin{beamerboxesrounded}[upper=block title,lower=block body,shadow=true]%
{raggedrightusebeamerfont*{block title}insertblocktitle}%
raggedright%
usebeamerfont{block body}%
}
begin{document}
section{}
begin{frame}{Example ref{block1}}
begin{block}{}label{block1}
lipsum[2]
end{block}
end{frame}
begin{frame}
content...
end{frame}
begin{frame}{Example ref{block2}}
begin{block}{}label{block2}
lipsum[2]
end{block}
end{frame}
end{document}
edited Nov 20 at 20:15
answered Nov 20 at 20:12
samcarter
82.5k793264
82.5k793264
Wow, many thanks @samcarter! This is exactly what I had in mind! That's amazing!
– Alex
Nov 20 at 20:14
@Alex You're welcome!
– samcarter
Nov 20 at 20:19
add a comment |
Wow, many thanks @samcarter! This is exactly what I had in mind! That's amazing!
– Alex
Nov 20 at 20:14
@Alex You're welcome!
– samcarter
Nov 20 at 20:19
Wow, many thanks @samcarter! This is exactly what I had in mind! That's amazing!
– Alex
Nov 20 at 20:14
Wow, many thanks @samcarter! This is exactly what I had in mind! That's amazing!
– Alex
Nov 20 at 20:14
@Alex You're welcome!
– samcarter
Nov 20 at 20:19
@Alex You're welcome!
– samcarter
Nov 20 at 20:19
add a comment |
Alex is a new contributor. Be nice, and check out our Code of Conduct.
Alex is a new contributor. Be nice, and check out our Code of Conduct.
Alex is a new contributor. Be nice, and check out our Code of Conduct.
Alex is a new contributor. Be nice, and check out our Code of Conduct.
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%2f461013%2flabel-blocks-inlcuding-section-number%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
Try
documentclass[serif,12pt,xcolor=dvipsnames]{beamer} usetheme{Madrid} usepackage{lipsum} begin{document} section{A section} begin{frame}{Example arabic{section}.ref{block1}} begin{block}{}label{block1} lipsum[2] end{block} end{frame} end{document}
– marmot
Nov 20 at 19:31
Many thanks @marmot, it works! I was wondering if there is a way to automatically include section number without having to type the section number in front of
ref{block1}
every time.– Alex
Nov 20 at 19:50
1
Of course, there is e.g. the
numberwithin
command that AFAIK comes with amsmath. That is, you need to declare your example to be a "theorem-like" environment that and then saynumberwithin{example}{section}
. I guess a reasonable starting point would be this answer and saynumberwithin{theorem}{section}
instead. Of course, it will be better to wait till @samcarter sees this question and gives a real answer. ;-)– marmot
Nov 20 at 19:57
I think the main problem is that blocks are not numbered and if you label them, you will get the framenumber. So your document above only works by chance. I'll see if I can add counters to the blocks.
– samcarter
Nov 20 at 20:07
1
@marmot For someone who claims that his crystal ball is missing, you are remarkably good at predicting the future... :)
– samcarter
Nov 20 at 20:18