Hangindent in Custom Environment created with tcolorbox's many Option
up vote
1
down vote
favorite
I wish I could be more specific, but being that I don't understand all of the underlying stuff that's happening, my question will have to be vague (hence the awkward title, I'll edit it to be more specific once I know the details), sorry.
Question: Why does settowidth{hangindent}{some text}
not work inside my lemma
environment (which is, I think, created using the many
option from tcolorbox
)?
(I've tried to adjust the parindent
, that used to fix some issues with indentation in other tcolorboxes I used, but apparently not here.)
Thanks in advance!
MWE:
documentclass{report}
% Packages used
usepackage[many]{tcolorbox}
% Counter (probably unrelated)
newcounter{lemmacounter}[chapter]
defthelemmacounter{thechapter.arabic{lemmacounter}}
% Where the problem probably lies
% lemma command for lemma environment using tcolorbox (somehow, I'm not really sure how this is working), with optional "name" argument
DeclareDocumentCommand lemma {o} {%
IfNoValueTF {#1} {%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}itshape %
settowidth{hangindent}{L-00 }hangafter=1 % Why does this not work?
}{%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}textbf{ (#1).}itshape
settowidth{hangindent}{L-00 }hangafter=1 % Why does this not work?
}%
}
begin{document}
begin{lemma}[Some Lemma]
Some text some text some text some text some text some text some text some text some text some text some text.
end{lemma}
end{document}
indentation tcolorbox
add a comment |
up vote
1
down vote
favorite
I wish I could be more specific, but being that I don't understand all of the underlying stuff that's happening, my question will have to be vague (hence the awkward title, I'll edit it to be more specific once I know the details), sorry.
Question: Why does settowidth{hangindent}{some text}
not work inside my lemma
environment (which is, I think, created using the many
option from tcolorbox
)?
(I've tried to adjust the parindent
, that used to fix some issues with indentation in other tcolorboxes I used, but apparently not here.)
Thanks in advance!
MWE:
documentclass{report}
% Packages used
usepackage[many]{tcolorbox}
% Counter (probably unrelated)
newcounter{lemmacounter}[chapter]
defthelemmacounter{thechapter.arabic{lemmacounter}}
% Where the problem probably lies
% lemma command for lemma environment using tcolorbox (somehow, I'm not really sure how this is working), with optional "name" argument
DeclareDocumentCommand lemma {o} {%
IfNoValueTF {#1} {%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}itshape %
settowidth{hangindent}{L-00 }hangafter=1 % Why does this not work?
}{%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}textbf{ (#1).}itshape
settowidth{hangindent}{L-00 }hangafter=1 % Why does this not work?
}%
}
begin{document}
begin{lemma}[Some Lemma]
Some text some text some text some text some text some text some text some text some text some text some text.
end{lemma}
end{document}
indentation tcolorbox
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I wish I could be more specific, but being that I don't understand all of the underlying stuff that's happening, my question will have to be vague (hence the awkward title, I'll edit it to be more specific once I know the details), sorry.
Question: Why does settowidth{hangindent}{some text}
not work inside my lemma
environment (which is, I think, created using the many
option from tcolorbox
)?
(I've tried to adjust the parindent
, that used to fix some issues with indentation in other tcolorboxes I used, but apparently not here.)
Thanks in advance!
MWE:
documentclass{report}
% Packages used
usepackage[many]{tcolorbox}
% Counter (probably unrelated)
newcounter{lemmacounter}[chapter]
defthelemmacounter{thechapter.arabic{lemmacounter}}
% Where the problem probably lies
% lemma command for lemma environment using tcolorbox (somehow, I'm not really sure how this is working), with optional "name" argument
DeclareDocumentCommand lemma {o} {%
IfNoValueTF {#1} {%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}itshape %
settowidth{hangindent}{L-00 }hangafter=1 % Why does this not work?
}{%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}textbf{ (#1).}itshape
settowidth{hangindent}{L-00 }hangafter=1 % Why does this not work?
}%
}
begin{document}
begin{lemma}[Some Lemma]
Some text some text some text some text some text some text some text some text some text some text some text.
end{lemma}
end{document}
indentation tcolorbox
I wish I could be more specific, but being that I don't understand all of the underlying stuff that's happening, my question will have to be vague (hence the awkward title, I'll edit it to be more specific once I know the details), sorry.
Question: Why does settowidth{hangindent}{some text}
not work inside my lemma
environment (which is, I think, created using the many
option from tcolorbox
)?
(I've tried to adjust the parindent
, that used to fix some issues with indentation in other tcolorboxes I used, but apparently not here.)
Thanks in advance!
MWE:
documentclass{report}
% Packages used
usepackage[many]{tcolorbox}
% Counter (probably unrelated)
newcounter{lemmacounter}[chapter]
defthelemmacounter{thechapter.arabic{lemmacounter}}
% Where the problem probably lies
% lemma command for lemma environment using tcolorbox (somehow, I'm not really sure how this is working), with optional "name" argument
DeclareDocumentCommand lemma {o} {%
IfNoValueTF {#1} {%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}itshape %
settowidth{hangindent}{L-00 }hangafter=1 % Why does this not work?
}{%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}textbf{ (#1).}itshape
settowidth{hangindent}{L-00 }hangafter=1 % Why does this not work?
}%
}
begin{document}
begin{lemma}[Some Lemma]
Some text some text some text some text some text some text some text some text some text some text some text.
end{lemma}
end{document}
indentation tcolorbox
indentation tcolorbox
asked Nov 17 at 4:10
ABlueChameleon
335
335
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
You can achieve your requirement by changing your definitions slightly, here it is:
newenvironment{lemma}[1][empty]{begingroup
if!#1!noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}itshape
else%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}textbf{ (#1)}itshapefi
settowidth{hangindent}{L-00 }hangafter=1%
}{par%this does the trick for the hangindent
endgroup}
Thank you very much for your answer, which works nicely; however, could I ask you what the error was in the original code, i.e. why it didn't work? (Also, a small irrelevant edit I can't make, it should be(#1).
.)
– ABlueChameleon
Nov 17 at 7:04
@ABlueChameleon Glad to hear that my advise helps you, and I already mentioned par does the trick, if you give par at the end of the paragraph manually, then your coding also works...
– MadyYuvi
Nov 17 at 7:10
Oh, I see. I thought that was particular to the new code. Then that's solved too. Thank you!
– ABlueChameleon
Nov 17 at 7:24
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
You can achieve your requirement by changing your definitions slightly, here it is:
newenvironment{lemma}[1][empty]{begingroup
if!#1!noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}itshape
else%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}textbf{ (#1)}itshapefi
settowidth{hangindent}{L-00 }hangafter=1%
}{par%this does the trick for the hangindent
endgroup}
Thank you very much for your answer, which works nicely; however, could I ask you what the error was in the original code, i.e. why it didn't work? (Also, a small irrelevant edit I can't make, it should be(#1).
.)
– ABlueChameleon
Nov 17 at 7:04
@ABlueChameleon Glad to hear that my advise helps you, and I already mentioned par does the trick, if you give par at the end of the paragraph manually, then your coding also works...
– MadyYuvi
Nov 17 at 7:10
Oh, I see. I thought that was particular to the new code. Then that's solved too. Thank you!
– ABlueChameleon
Nov 17 at 7:24
add a comment |
up vote
1
down vote
accepted
You can achieve your requirement by changing your definitions slightly, here it is:
newenvironment{lemma}[1][empty]{begingroup
if!#1!noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}itshape
else%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}textbf{ (#1)}itshapefi
settowidth{hangindent}{L-00 }hangafter=1%
}{par%this does the trick for the hangindent
endgroup}
Thank you very much for your answer, which works nicely; however, could I ask you what the error was in the original code, i.e. why it didn't work? (Also, a small irrelevant edit I can't make, it should be(#1).
.)
– ABlueChameleon
Nov 17 at 7:04
@ABlueChameleon Glad to hear that my advise helps you, and I already mentioned par does the trick, if you give par at the end of the paragraph manually, then your coding also works...
– MadyYuvi
Nov 17 at 7:10
Oh, I see. I thought that was particular to the new code. Then that's solved too. Thank you!
– ABlueChameleon
Nov 17 at 7:24
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
You can achieve your requirement by changing your definitions slightly, here it is:
newenvironment{lemma}[1][empty]{begingroup
if!#1!noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}itshape
else%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}textbf{ (#1)}itshapefi
settowidth{hangindent}{L-00 }hangafter=1%
}{par%this does the trick for the hangindent
endgroup}
You can achieve your requirement by changing your definitions slightly, here it is:
newenvironment{lemma}[1][empty]{begingroup
if!#1!noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}itshape
else%
noindentrefstepcounter{lemmacounter}colorbox{black!10}{textbf{L-thelemmacounter}}textbf{ (#1)}itshapefi
settowidth{hangindent}{L-00 }hangafter=1%
}{par%this does the trick for the hangindent
endgroup}
answered Nov 17 at 6:58
MadyYuvi
1,984211
1,984211
Thank you very much for your answer, which works nicely; however, could I ask you what the error was in the original code, i.e. why it didn't work? (Also, a small irrelevant edit I can't make, it should be(#1).
.)
– ABlueChameleon
Nov 17 at 7:04
@ABlueChameleon Glad to hear that my advise helps you, and I already mentioned par does the trick, if you give par at the end of the paragraph manually, then your coding also works...
– MadyYuvi
Nov 17 at 7:10
Oh, I see. I thought that was particular to the new code. Then that's solved too. Thank you!
– ABlueChameleon
Nov 17 at 7:24
add a comment |
Thank you very much for your answer, which works nicely; however, could I ask you what the error was in the original code, i.e. why it didn't work? (Also, a small irrelevant edit I can't make, it should be(#1).
.)
– ABlueChameleon
Nov 17 at 7:04
@ABlueChameleon Glad to hear that my advise helps you, and I already mentioned par does the trick, if you give par at the end of the paragraph manually, then your coding also works...
– MadyYuvi
Nov 17 at 7:10
Oh, I see. I thought that was particular to the new code. Then that's solved too. Thank you!
– ABlueChameleon
Nov 17 at 7:24
Thank you very much for your answer, which works nicely; however, could I ask you what the error was in the original code, i.e. why it didn't work? (Also, a small irrelevant edit I can't make, it should be
(#1).
.)– ABlueChameleon
Nov 17 at 7:04
Thank you very much for your answer, which works nicely; however, could I ask you what the error was in the original code, i.e. why it didn't work? (Also, a small irrelevant edit I can't make, it should be
(#1).
.)– ABlueChameleon
Nov 17 at 7:04
@ABlueChameleon Glad to hear that my advise helps you, and I already mentioned par does the trick, if you give par at the end of the paragraph manually, then your coding also works...
– MadyYuvi
Nov 17 at 7:10
@ABlueChameleon Glad to hear that my advise helps you, and I already mentioned par does the trick, if you give par at the end of the paragraph manually, then your coding also works...
– MadyYuvi
Nov 17 at 7:10
Oh, I see. I thought that was particular to the new code. Then that's solved too. Thank you!
– ABlueChameleon
Nov 17 at 7:24
Oh, I see. I thought that was particular to the new code. Then that's solved too. Thank you!
– ABlueChameleon
Nov 17 at 7:24
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460402%2fhangindent-in-custom-environment-created-with-tcolorboxs-many-option%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