Problem with vertical alignment of a multicolumn listing in a tcolorbox Unicorn Meta Zoo #1:...
How would this chord from "Rocket Man" be analyzed?
Why did Israel vote against lifting the American embargo on Cuba?
What is the least dense liquid under normal conditions?
How would I use different systems of magic when they are capable of the same effects?
Protagonist's race is hidden - should I reveal it?
Need of separate security plugins for both root and subfolder sites Wordpress?
Why is this method for solving linear equations systems using determinants works?
Could moose/elk survive in the Amazon forest?
Visa-free travel to the US using refugee travel document from Spain?
Suing a Police Officer Instead of the Police Department
Is Electric Central Heating worth it if using Solar Panels?
What was Apollo 13's "Little Jolt" after MECO?
Passing args from the bash script to the function in the script
As an international instructor, should I openly talk about my accent?
Trumpet valves, lengths, and pitch
Justification for leaving new position after a short time
Why is an operator the quantum mechanical analogue of an observable?
Is a 5 watt UHF/VHF handheld considered QRP?
Is there any hidden 'W' sound after 'comment' in : Comment est-elle?
Check if a string is entirely made of the same substring
Is Diceware more secure than a long passphrase?
Align column where each cell has two decimals with siunitx
How to use @AuraEnabled base class method in Lightning Component?
Why did C use the -> operator instead of reusing the . operator?
Problem with vertical alignment of a multicolumn listing in a tcolorbox
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraProblem with Table Vertical Alignmenttcolorbox: vertical spacing in a tcolorboxVertical alignment of “nobeforeafter” tcolorboxVertical alignment problemEquations in tcolorbox. Vertical alignmentProblem with nested minted listing inside a tcolorboxtcolorbox: problem with “colbacklower” and “text outside listing”CodeBlocks listing with tcolorboxtcolorbox vertical alignmentAlignment problem with title in rather complex tcolorbox
Consider the following test code:
% ---------------------------------------------------------------------------- %
% File
begin{filecontents*}{jobname.cpp}
0000
0000
end{filecontents*}
begin{filecontents*}{multijobname.cpp}
0000
0000
0000
0000
end{filecontents*}
% ---------------------------------------------------------------------------- %
% Preamble
documentclass[letterpaper, 12pt, onecolumn]{article}
% ---------------------------------------------------------------------------- %
% Packages
usepackage{xcolor}
usepackage{listings}
usepackage{multicol}
usepackage[most]{tcolorbox}
% ---------------------------------------------------------------------------- %
% Listings options
definecolor{grey}{RGB}{224, 224, 224}
newtcbinputlisting{inputcode}[4][normalsize]{
code = {},
enhanced,
listing only,
top = 0pt,
bottom = 0pt,
left = 0pt,
right = 0pt,
arc = 0pt,
outer arc = 0pt,
boxsep = 0pt,
titlerule = 0pt,
colback = grey,
colframe = black,
boxrule = 2pt,
title = {centering{fontfamily{cmtt}selectfont#2strut}},
listing options = {
language = C++,
framesep = 0pt,
rulesep = 0pt,
aboveskip = 0pt,
belowskip = 0pt,
basicstyle = fontfamily{cmtt}selectfont#1,
#3,
},
listing file={#4},
}
% ---------------------------------------------------------------------------- %
% Commands
newcommand{alphabet}{%
small{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz}%
}
newcommand{makelisting}[2]{%
newpage%
noindentalphabet%
inputcode[#1]{#2}{}{jobname.cpp}%
noindentalphabet%
inputcode[#1]{#2}{multicols = 2}{multijobname.cpp}%
noindentalphabet%
}
% ---------------------------------------------------------------------------- %
% Document
begin{document}
makelisting{tiny}{tiny}
makelisting{scriptsize}{scriptsize}
makelisting{footnotesize}{footnotesize}
makelisting{small}{small}
makelisting{normalsize}{normalsize}
makelisting{large}{large}
makelisting{Large}{Large}
makelisting{LARGE}{LARGE}
makelisting{huge}{huge}
makelisting{Huge}{Huge}
end{document}
% ---------------------------------------------------------------------------- %
It produces pairs of listings in tcolorboxes: one without multicolumn and the other with multicolumn. Examples of the output:
On these images:
- the distance between the top of the listing and the top of the first line corresponds to the red arrows
- the distance between the bottom of the listing and the bottom of the last line corresponds to the blue arrows
As show, the multicols
option changes these distances. The change seems affected by the size of the font in the listing (as well as the size of normalsize
specified in the document class).
How to correct the vertical spacing so that the spacing of the multicols
version corresponds to the spacing without the multicols
? (in a generic manner that would work for all font sizes)
spacing vertical-alignment listings tcolorbox multicol
add a comment |
Consider the following test code:
% ---------------------------------------------------------------------------- %
% File
begin{filecontents*}{jobname.cpp}
0000
0000
end{filecontents*}
begin{filecontents*}{multijobname.cpp}
0000
0000
0000
0000
end{filecontents*}
% ---------------------------------------------------------------------------- %
% Preamble
documentclass[letterpaper, 12pt, onecolumn]{article}
% ---------------------------------------------------------------------------- %
% Packages
usepackage{xcolor}
usepackage{listings}
usepackage{multicol}
usepackage[most]{tcolorbox}
% ---------------------------------------------------------------------------- %
% Listings options
definecolor{grey}{RGB}{224, 224, 224}
newtcbinputlisting{inputcode}[4][normalsize]{
code = {},
enhanced,
listing only,
top = 0pt,
bottom = 0pt,
left = 0pt,
right = 0pt,
arc = 0pt,
outer arc = 0pt,
boxsep = 0pt,
titlerule = 0pt,
colback = grey,
colframe = black,
boxrule = 2pt,
title = {centering{fontfamily{cmtt}selectfont#2strut}},
listing options = {
language = C++,
framesep = 0pt,
rulesep = 0pt,
aboveskip = 0pt,
belowskip = 0pt,
basicstyle = fontfamily{cmtt}selectfont#1,
#3,
},
listing file={#4},
}
% ---------------------------------------------------------------------------- %
% Commands
newcommand{alphabet}{%
small{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz}%
}
newcommand{makelisting}[2]{%
newpage%
noindentalphabet%
inputcode[#1]{#2}{}{jobname.cpp}%
noindentalphabet%
inputcode[#1]{#2}{multicols = 2}{multijobname.cpp}%
noindentalphabet%
}
% ---------------------------------------------------------------------------- %
% Document
begin{document}
makelisting{tiny}{tiny}
makelisting{scriptsize}{scriptsize}
makelisting{footnotesize}{footnotesize}
makelisting{small}{small}
makelisting{normalsize}{normalsize}
makelisting{large}{large}
makelisting{Large}{Large}
makelisting{LARGE}{LARGE}
makelisting{huge}{huge}
makelisting{Huge}{Huge}
end{document}
% ---------------------------------------------------------------------------- %
It produces pairs of listings in tcolorboxes: one without multicolumn and the other with multicolumn. Examples of the output:
On these images:
- the distance between the top of the listing and the top of the first line corresponds to the red arrows
- the distance between the bottom of the listing and the bottom of the last line corresponds to the blue arrows
As show, the multicols
option changes these distances. The change seems affected by the size of the font in the listing (as well as the size of normalsize
specified in the document class).
How to correct the vertical spacing so that the spacing of the multicols
version corresponds to the spacing without the multicols
? (in a generic manner that would work for all font sizes)
spacing vertical-alignment listings tcolorbox multicol
add a comment |
Consider the following test code:
% ---------------------------------------------------------------------------- %
% File
begin{filecontents*}{jobname.cpp}
0000
0000
end{filecontents*}
begin{filecontents*}{multijobname.cpp}
0000
0000
0000
0000
end{filecontents*}
% ---------------------------------------------------------------------------- %
% Preamble
documentclass[letterpaper, 12pt, onecolumn]{article}
% ---------------------------------------------------------------------------- %
% Packages
usepackage{xcolor}
usepackage{listings}
usepackage{multicol}
usepackage[most]{tcolorbox}
% ---------------------------------------------------------------------------- %
% Listings options
definecolor{grey}{RGB}{224, 224, 224}
newtcbinputlisting{inputcode}[4][normalsize]{
code = {},
enhanced,
listing only,
top = 0pt,
bottom = 0pt,
left = 0pt,
right = 0pt,
arc = 0pt,
outer arc = 0pt,
boxsep = 0pt,
titlerule = 0pt,
colback = grey,
colframe = black,
boxrule = 2pt,
title = {centering{fontfamily{cmtt}selectfont#2strut}},
listing options = {
language = C++,
framesep = 0pt,
rulesep = 0pt,
aboveskip = 0pt,
belowskip = 0pt,
basicstyle = fontfamily{cmtt}selectfont#1,
#3,
},
listing file={#4},
}
% ---------------------------------------------------------------------------- %
% Commands
newcommand{alphabet}{%
small{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz}%
}
newcommand{makelisting}[2]{%
newpage%
noindentalphabet%
inputcode[#1]{#2}{}{jobname.cpp}%
noindentalphabet%
inputcode[#1]{#2}{multicols = 2}{multijobname.cpp}%
noindentalphabet%
}
% ---------------------------------------------------------------------------- %
% Document
begin{document}
makelisting{tiny}{tiny}
makelisting{scriptsize}{scriptsize}
makelisting{footnotesize}{footnotesize}
makelisting{small}{small}
makelisting{normalsize}{normalsize}
makelisting{large}{large}
makelisting{Large}{Large}
makelisting{LARGE}{LARGE}
makelisting{huge}{huge}
makelisting{Huge}{Huge}
end{document}
% ---------------------------------------------------------------------------- %
It produces pairs of listings in tcolorboxes: one without multicolumn and the other with multicolumn. Examples of the output:
On these images:
- the distance between the top of the listing and the top of the first line corresponds to the red arrows
- the distance between the bottom of the listing and the bottom of the last line corresponds to the blue arrows
As show, the multicols
option changes these distances. The change seems affected by the size of the font in the listing (as well as the size of normalsize
specified in the document class).
How to correct the vertical spacing so that the spacing of the multicols
version corresponds to the spacing without the multicols
? (in a generic manner that would work for all font sizes)
spacing vertical-alignment listings tcolorbox multicol
Consider the following test code:
% ---------------------------------------------------------------------------- %
% File
begin{filecontents*}{jobname.cpp}
0000
0000
end{filecontents*}
begin{filecontents*}{multijobname.cpp}
0000
0000
0000
0000
end{filecontents*}
% ---------------------------------------------------------------------------- %
% Preamble
documentclass[letterpaper, 12pt, onecolumn]{article}
% ---------------------------------------------------------------------------- %
% Packages
usepackage{xcolor}
usepackage{listings}
usepackage{multicol}
usepackage[most]{tcolorbox}
% ---------------------------------------------------------------------------- %
% Listings options
definecolor{grey}{RGB}{224, 224, 224}
newtcbinputlisting{inputcode}[4][normalsize]{
code = {},
enhanced,
listing only,
top = 0pt,
bottom = 0pt,
left = 0pt,
right = 0pt,
arc = 0pt,
outer arc = 0pt,
boxsep = 0pt,
titlerule = 0pt,
colback = grey,
colframe = black,
boxrule = 2pt,
title = {centering{fontfamily{cmtt}selectfont#2strut}},
listing options = {
language = C++,
framesep = 0pt,
rulesep = 0pt,
aboveskip = 0pt,
belowskip = 0pt,
basicstyle = fontfamily{cmtt}selectfont#1,
#3,
},
listing file={#4},
}
% ---------------------------------------------------------------------------- %
% Commands
newcommand{alphabet}{%
small{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz}%
}
newcommand{makelisting}[2]{%
newpage%
noindentalphabet%
inputcode[#1]{#2}{}{jobname.cpp}%
noindentalphabet%
inputcode[#1]{#2}{multicols = 2}{multijobname.cpp}%
noindentalphabet%
}
% ---------------------------------------------------------------------------- %
% Document
begin{document}
makelisting{tiny}{tiny}
makelisting{scriptsize}{scriptsize}
makelisting{footnotesize}{footnotesize}
makelisting{small}{small}
makelisting{normalsize}{normalsize}
makelisting{large}{large}
makelisting{Large}{Large}
makelisting{LARGE}{LARGE}
makelisting{huge}{huge}
makelisting{Huge}{Huge}
end{document}
% ---------------------------------------------------------------------------- %
It produces pairs of listings in tcolorboxes: one without multicolumn and the other with multicolumn. Examples of the output:
On these images:
- the distance between the top of the listing and the top of the first line corresponds to the red arrows
- the distance between the bottom of the listing and the bottom of the last line corresponds to the blue arrows
As show, the multicols
option changes these distances. The change seems affected by the size of the font in the listing (as well as the size of normalsize
specified in the document class).
How to correct the vertical spacing so that the spacing of the multicols
version corresponds to the spacing without the multicols
? (in a generic manner that would work for all font sizes)
spacing vertical-alignment listings tcolorbox multicol
spacing vertical-alignment listings tcolorbox multicol
edited 11 mins ago
Vincent
asked 14 hours ago
VincentVincent
1,76221939
1,76221939
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%2f487356%2fproblem-with-vertical-alignment-of-a-multicolumn-listing-in-a-tcolorbox%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%2f487356%2fproblem-with-vertical-alignment-of-a-multicolumn-listing-in-a-tcolorbox%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