TeX - LaTeX Asked on July 1, 2021
In the following MWE, why is there an extra vertical space in Example 2 ?
documentclass{article}
usepackage[most]{tcolorbox}
usepackage{showframe}
usepackage{harmony}
newtcolorbox{myFrame}
{colback = red, colframe = white, top = 0mm, bottom = 0mm, boxrule = 0pt, left = 2mm, right = 2mm}
newcommand{easy}{%
llap{parbox[t][0pt]{1.7cm}{%
Acht{}test
small{}easy
}}%
}
newcommand{easyBis}{%
llap{parbox[t][0pt]{1.7cm}{%
test
small{}easy
}}%
}
begin{document}
begin{myFrame}
easy
Example 1par
This is the text of the exercise.par
By the way, I use tcolorbox to make my boxes.
end{myFrame}
begin{myFrame}
easyBis
Example 2par
This is the text of the exercise.par
By the way, I use tcolorbox to make my boxes.
end{myFrame}
end{document}
Don't use primitive tex boxes in vertical mode, they rarely do what you expect.
documentclass{article}
usepackage[most]{tcolorbox}
usepackage{showframe}
usepackage{harmony}
newtcolorbox{myFrame}
{colback = red, colframe = white, top = 0mm, bottom = 0mm, boxrule = 0pt, left = 2mm, right = 2mm}
newcommand{easy}{%
leavevmodellap{parbox[t][0pt]{1.7cm}{%
leavevmodeAcht{}test
small{}easy
}}%
}
newcommand{easyBis}{%
leavevmodellap{parbox[t][0pt]{1.7cm}{%
test
small{}easy
}}%
}
begin{document}
begin{myFrame}
easy
Example 1par
This is the text of the exercise.par
By the way, I use tcolorbox to make my boxes.
end{myFrame}
begin{myFrame}
easyBis
Example 2par
This is the text of the exercise.par
By the way, I use tcolorbox to make my boxes.
end{myFrame}
end{document}
or better, also hiding the height of note to get the same space above Example
documentclass{article}
usepackage[most]{tcolorbox}
usepackage{showframe}
usepackage{harmony}
newtcolorbox{myFrame}
{colback = red, colframe = white, top = 0mm, bottom = 0mm, boxrule = 0pt, left = 2mm, right = 2mm}
newcommand{easy}{%
leavevmodellap{parbox[t][0pt]{1.7cm}{%
leavevmodestrutsmash{Acht}test
small{}easy
}}%
}
newcommand{easyBis}{%
leavevmodestrutllap{parbox[t][0pt]{1.7cm}{%
test
small{}easy
}}%
}
begin{document}
begin{myFrame}
easy
Example 1par
This is the text of the exercise.par
By the way, I use tcolorbox to make my boxes.
end{myFrame}
begin{myFrame}
easyBis
Example 2par
This is the text of the exercise.par
By the way, I use tcolorbox to make my boxes.
end{myFrame}
end{document}
Correct answer by David Carlisle on July 1, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP