Changing a tcolorbox listing option based on the number of lines of its listingtcolorbox: option for...
Is there a way to get a compiler for the original B programming language?
How exactly does Hawking radiation decrease the mass of black holes?
What is the difference between `command a[bc]d` and `command `a{b,c}d`
Was there a shared-world project before "Thieves World"?
Is the 5 MB static resource size limit 5,242,880 bytes or 5,000,000 bytes?
Repelling Blast: Must targets always be pushed back?
How come there are so many candidates for the 2020 Democratic party presidential nomination?
Examples of subgroups where it's nontrivial to show closure under multiplication?
Fizzy, soft, pop and still drinks
Why other Westeros houses don't use wildfire?
Was there a Viking Exchange as well as a Columbian one?
simple conditions equation
How to type a section sign (§) into the Minecraft client
Please, smoke with good manners
How to make a pipeline wait for end-of-file or stop after an error?
How did Captain America manage to do this?
Why was Germany not as successful as other Europeans in establishing overseas colonies?
Reducing vertical space in stackrel
Apply MapThread to all but one variable
Is there an official tutorial for installing Ubuntu 18.04+ on a device with an SSD and an additional internal hard drive?
Are Boeing 737-800’s grounded?
Will tsunami waves travel forever if there was no land?
Examples of non trivial equivalence relations , I mean equivalence relations without the expression " same ... as" in their definition?
How to pronounce 'C++' in Spanish
Changing a tcolorbox listing option based on the number of lines of its listing
tcolorbox: option for “listing outside (but ABOVE) text”refstepcounter in tcolorbox optionlisting in minipage sucks content of previous page to the bottomChanging the line number in code listingCodeBlocks listing with tcolorboxtcolorbox and multiple lines in its titlelstnewenvironment/lstset : using colors conditionally emph/emphstyle - SAS: (in=_x) versus if x in (1,2)tcolorbox: unset or overrule option “listing side text”Changing listing numbersProblem with vertical alignment of a multicolumn listing in a tcolorbox
Consider the following code which produces listings:
% ---------------------------------------------------------------------------- %
% Preamble
documentclass[12pt]{article}
% ---------------------------------------------------------------------------- %
% Packages
usepackage{calc}
usepackage{xcolor}
usepackage{listings}
usepackage{multicol}
usepackage{printlen}
usepackage[most]{tcolorbox}
% ---------------------------------------------------------------------------- %
% Length
newlength{evenlength}
setlength{evenlength}{0pt}
newlength{oddlength}
setlength{oddlength}{10pt}
% ---------------------------------------------------------------------------- %
% Listing
newtcblisting{lstbox}[4][normalsize]{
code = {},
enhanced,
listing only,
top = 0pt,
%%%%%%
% I want bottom to be equal to:
% - evenlength if the listing has an even number of lines
% - oddlength if the listing has an even number of lines
bottom = 0pt,
%%%%%%
left = 0pt,
right = 0pt,
arc = 0pt,
outer arc = 0pt,
boxsep = 0pt,
titlerule = 0pt,
colback = red,
colframe = black,
boxrule = 2pt,
title = {centering{fontfamily{cmtt}selectfont#2strut}},
listing options = {
language = C++,
framesep = 0pt,
rulesep = 0pt,
aboveskip = 0pt,
belowskip = 0pt,
backgroundcolor = color{lightgray},
basicstyle = fontfamily{cmtt}selectfont#1,
#3,
},
#4,
}
% ---------------------------------------------------------------------------- %
% Document
pagestyle{empty}
begin{document}
begin{lstbox}[small]{title}{}{}
1
2
end{lstbox}
begin{lstbox}[small]{title}{}{}
1
2
3
end{lstbox}
begin{lstbox}[small]{title}{}{}
1
2
3
4
end{lstbox}
end{document}
% ---------------------------------------------------------------------------- %
Would there be a way to make the tcolorbox
bottom
option equal to
evenlength
when the listing has an even number of lines
oddlength
when the listing has an odd number of lines
listings environments tcolorbox counters programming
add a comment |
Consider the following code which produces listings:
% ---------------------------------------------------------------------------- %
% Preamble
documentclass[12pt]{article}
% ---------------------------------------------------------------------------- %
% Packages
usepackage{calc}
usepackage{xcolor}
usepackage{listings}
usepackage{multicol}
usepackage{printlen}
usepackage[most]{tcolorbox}
% ---------------------------------------------------------------------------- %
% Length
newlength{evenlength}
setlength{evenlength}{0pt}
newlength{oddlength}
setlength{oddlength}{10pt}
% ---------------------------------------------------------------------------- %
% Listing
newtcblisting{lstbox}[4][normalsize]{
code = {},
enhanced,
listing only,
top = 0pt,
%%%%%%
% I want bottom to be equal to:
% - evenlength if the listing has an even number of lines
% - oddlength if the listing has an even number of lines
bottom = 0pt,
%%%%%%
left = 0pt,
right = 0pt,
arc = 0pt,
outer arc = 0pt,
boxsep = 0pt,
titlerule = 0pt,
colback = red,
colframe = black,
boxrule = 2pt,
title = {centering{fontfamily{cmtt}selectfont#2strut}},
listing options = {
language = C++,
framesep = 0pt,
rulesep = 0pt,
aboveskip = 0pt,
belowskip = 0pt,
backgroundcolor = color{lightgray},
basicstyle = fontfamily{cmtt}selectfont#1,
#3,
},
#4,
}
% ---------------------------------------------------------------------------- %
% Document
pagestyle{empty}
begin{document}
begin{lstbox}[small]{title}{}{}
1
2
end{lstbox}
begin{lstbox}[small]{title}{}{}
1
2
3
end{lstbox}
begin{lstbox}[small]{title}{}{}
1
2
3
4
end{lstbox}
end{document}
% ---------------------------------------------------------------------------- %
Would there be a way to make the tcolorbox
bottom
option equal to
evenlength
when the listing has an even number of lines
oddlength
when the listing has an odd number of lines
listings environments tcolorbox counters programming
add a comment |
Consider the following code which produces listings:
% ---------------------------------------------------------------------------- %
% Preamble
documentclass[12pt]{article}
% ---------------------------------------------------------------------------- %
% Packages
usepackage{calc}
usepackage{xcolor}
usepackage{listings}
usepackage{multicol}
usepackage{printlen}
usepackage[most]{tcolorbox}
% ---------------------------------------------------------------------------- %
% Length
newlength{evenlength}
setlength{evenlength}{0pt}
newlength{oddlength}
setlength{oddlength}{10pt}
% ---------------------------------------------------------------------------- %
% Listing
newtcblisting{lstbox}[4][normalsize]{
code = {},
enhanced,
listing only,
top = 0pt,
%%%%%%
% I want bottom to be equal to:
% - evenlength if the listing has an even number of lines
% - oddlength if the listing has an even number of lines
bottom = 0pt,
%%%%%%
left = 0pt,
right = 0pt,
arc = 0pt,
outer arc = 0pt,
boxsep = 0pt,
titlerule = 0pt,
colback = red,
colframe = black,
boxrule = 2pt,
title = {centering{fontfamily{cmtt}selectfont#2strut}},
listing options = {
language = C++,
framesep = 0pt,
rulesep = 0pt,
aboveskip = 0pt,
belowskip = 0pt,
backgroundcolor = color{lightgray},
basicstyle = fontfamily{cmtt}selectfont#1,
#3,
},
#4,
}
% ---------------------------------------------------------------------------- %
% Document
pagestyle{empty}
begin{document}
begin{lstbox}[small]{title}{}{}
1
2
end{lstbox}
begin{lstbox}[small]{title}{}{}
1
2
3
end{lstbox}
begin{lstbox}[small]{title}{}{}
1
2
3
4
end{lstbox}
end{document}
% ---------------------------------------------------------------------------- %
Would there be a way to make the tcolorbox
bottom
option equal to
evenlength
when the listing has an even number of lines
oddlength
when the listing has an odd number of lines
listings environments tcolorbox counters programming
Consider the following code which produces listings:
% ---------------------------------------------------------------------------- %
% Preamble
documentclass[12pt]{article}
% ---------------------------------------------------------------------------- %
% Packages
usepackage{calc}
usepackage{xcolor}
usepackage{listings}
usepackage{multicol}
usepackage{printlen}
usepackage[most]{tcolorbox}
% ---------------------------------------------------------------------------- %
% Length
newlength{evenlength}
setlength{evenlength}{0pt}
newlength{oddlength}
setlength{oddlength}{10pt}
% ---------------------------------------------------------------------------- %
% Listing
newtcblisting{lstbox}[4][normalsize]{
code = {},
enhanced,
listing only,
top = 0pt,
%%%%%%
% I want bottom to be equal to:
% - evenlength if the listing has an even number of lines
% - oddlength if the listing has an even number of lines
bottom = 0pt,
%%%%%%
left = 0pt,
right = 0pt,
arc = 0pt,
outer arc = 0pt,
boxsep = 0pt,
titlerule = 0pt,
colback = red,
colframe = black,
boxrule = 2pt,
title = {centering{fontfamily{cmtt}selectfont#2strut}},
listing options = {
language = C++,
framesep = 0pt,
rulesep = 0pt,
aboveskip = 0pt,
belowskip = 0pt,
backgroundcolor = color{lightgray},
basicstyle = fontfamily{cmtt}selectfont#1,
#3,
},
#4,
}
% ---------------------------------------------------------------------------- %
% Document
pagestyle{empty}
begin{document}
begin{lstbox}[small]{title}{}{}
1
2
end{lstbox}
begin{lstbox}[small]{title}{}{}
1
2
3
end{lstbox}
begin{lstbox}[small]{title}{}{}
1
2
3
4
end{lstbox}
end{document}
% ---------------------------------------------------------------------------- %
Would there be a way to make the tcolorbox
bottom
option equal to
evenlength
when the listing has an even number of lines
oddlength
when the listing has an odd number of lines
listings environments tcolorbox counters programming
listings environments tcolorbox counters programming
asked 11 mins ago
VincentVincent
1,74121939
1,74121939
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f487999%2fchanging-a-tcolorbox-listing-option-based-on-the-number-of-lines-of-its-listing%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
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%2f487999%2fchanging-a-tcolorbox-listing-option-based-on-the-number-of-lines-of-its-listing%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