Grouping enumerated list with different width?
I found this nice answer regarding grouping of enumerated list. But it does not work for lists with different width. For instance
documentclass{article}
usepackage{tikz}
usetikzlibrary{decorations.pathreplacing}
newcommand{tikzmark}[1]{tikz[overlay,remember picture] node[baseline] (#1) {};}
tikzset{My Node Style/.style={midway, right, xshift=3.0ex, align=left, font=small, draw=none, thin, text=black}}
newcommandVerticalBrace[4]{%
% #1 = draw options
% #2 = top mark
% #2 = bottom mark
% #4 = label
begin{tikzpicture}[overlay,remember picture]
draw[decorate,decoration={brace, amplitude=1.5ex}, #1]
([yshift=1ex]#2.north east) -- ([yshift=-1ex]#3.south east)
node[My Node Style] {#4};
end{tikzpicture}
}
begin{document}
begin{enumerate}
item Item 1tikzmark{top 1}
item Item wide wide widetikzmark{bottom 1}
item Item 3tikzmark{top 2}
item Item 4
item Item wide wide wide
item Item 6tikzmark{bottom 2}
end{enumerate}
VerticalBrace[ultra thick, blue]{top 1}{bottom 1}{The first two items}
VerticalBrace[ultra thick, blue]{top 2}{bottom 2}{The last four items}
end{document}
gives
How can I fix this?
tikz-pgf enumerate braces grouping
add a comment |
I found this nice answer regarding grouping of enumerated list. But it does not work for lists with different width. For instance
documentclass{article}
usepackage{tikz}
usetikzlibrary{decorations.pathreplacing}
newcommand{tikzmark}[1]{tikz[overlay,remember picture] node[baseline] (#1) {};}
tikzset{My Node Style/.style={midway, right, xshift=3.0ex, align=left, font=small, draw=none, thin, text=black}}
newcommandVerticalBrace[4]{%
% #1 = draw options
% #2 = top mark
% #2 = bottom mark
% #4 = label
begin{tikzpicture}[overlay,remember picture]
draw[decorate,decoration={brace, amplitude=1.5ex}, #1]
([yshift=1ex]#2.north east) -- ([yshift=-1ex]#3.south east)
node[My Node Style] {#4};
end{tikzpicture}
}
begin{document}
begin{enumerate}
item Item 1tikzmark{top 1}
item Item wide wide widetikzmark{bottom 1}
item Item 3tikzmark{top 2}
item Item 4
item Item wide wide wide
item Item 6tikzmark{bottom 2}
end{enumerate}
VerticalBrace[ultra thick, blue]{top 1}{bottom 1}{The first two items}
VerticalBrace[ultra thick, blue]{top 2}{bottom 2}{The last four items}
end{document}
gives
How can I fix this?
tikz-pgf enumerate braces grouping
It might not be a good solution at the first glance, but did you try to add some extra space to shorter items withhspace
?
– Majid Abdolshah
Apr 2 at 6:44
@MajidAbdolshah It will certainly make ugly braces. It is very hard to make the braces absolutely vertical.
– JouleV
Apr 2 at 7:05
add a comment |
I found this nice answer regarding grouping of enumerated list. But it does not work for lists with different width. For instance
documentclass{article}
usepackage{tikz}
usetikzlibrary{decorations.pathreplacing}
newcommand{tikzmark}[1]{tikz[overlay,remember picture] node[baseline] (#1) {};}
tikzset{My Node Style/.style={midway, right, xshift=3.0ex, align=left, font=small, draw=none, thin, text=black}}
newcommandVerticalBrace[4]{%
% #1 = draw options
% #2 = top mark
% #2 = bottom mark
% #4 = label
begin{tikzpicture}[overlay,remember picture]
draw[decorate,decoration={brace, amplitude=1.5ex}, #1]
([yshift=1ex]#2.north east) -- ([yshift=-1ex]#3.south east)
node[My Node Style] {#4};
end{tikzpicture}
}
begin{document}
begin{enumerate}
item Item 1tikzmark{top 1}
item Item wide wide widetikzmark{bottom 1}
item Item 3tikzmark{top 2}
item Item 4
item Item wide wide wide
item Item 6tikzmark{bottom 2}
end{enumerate}
VerticalBrace[ultra thick, blue]{top 1}{bottom 1}{The first two items}
VerticalBrace[ultra thick, blue]{top 2}{bottom 2}{The last four items}
end{document}
gives
How can I fix this?
tikz-pgf enumerate braces grouping
I found this nice answer regarding grouping of enumerated list. But it does not work for lists with different width. For instance
documentclass{article}
usepackage{tikz}
usetikzlibrary{decorations.pathreplacing}
newcommand{tikzmark}[1]{tikz[overlay,remember picture] node[baseline] (#1) {};}
tikzset{My Node Style/.style={midway, right, xshift=3.0ex, align=left, font=small, draw=none, thin, text=black}}
newcommandVerticalBrace[4]{%
% #1 = draw options
% #2 = top mark
% #2 = bottom mark
% #4 = label
begin{tikzpicture}[overlay,remember picture]
draw[decorate,decoration={brace, amplitude=1.5ex}, #1]
([yshift=1ex]#2.north east) -- ([yshift=-1ex]#3.south east)
node[My Node Style] {#4};
end{tikzpicture}
}
begin{document}
begin{enumerate}
item Item 1tikzmark{top 1}
item Item wide wide widetikzmark{bottom 1}
item Item 3tikzmark{top 2}
item Item 4
item Item wide wide wide
item Item 6tikzmark{bottom 2}
end{enumerate}
VerticalBrace[ultra thick, blue]{top 1}{bottom 1}{The first two items}
VerticalBrace[ultra thick, blue]{top 2}{bottom 2}{The last four items}
end{document}
gives
How can I fix this?
tikz-pgf enumerate braces grouping
tikz-pgf enumerate braces grouping
edited Apr 2 at 7:02
marya
asked Apr 2 at 6:01
maryamarya
1,45031025
1,45031025
It might not be a good solution at the first glance, but did you try to add some extra space to shorter items withhspace
?
– Majid Abdolshah
Apr 2 at 6:44
@MajidAbdolshah It will certainly make ugly braces. It is very hard to make the braces absolutely vertical.
– JouleV
Apr 2 at 7:05
add a comment |
It might not be a good solution at the first glance, but did you try to add some extra space to shorter items withhspace
?
– Majid Abdolshah
Apr 2 at 6:44
@MajidAbdolshah It will certainly make ugly braces. It is very hard to make the braces absolutely vertical.
– JouleV
Apr 2 at 7:05
It might not be a good solution at the first glance, but did you try to add some extra space to shorter items with
hspace
?– Majid Abdolshah
Apr 2 at 6:44
It might not be a good solution at the first glance, but did you try to add some extra space to shorter items with
hspace
?– Majid Abdolshah
Apr 2 at 6:44
@MajidAbdolshah It will certainly make ugly braces. It is very hard to make the braces absolutely vertical.
– JouleV
Apr 2 at 7:05
@MajidAbdolshah It will certainly make ugly braces. It is very hard to make the braces absolutely vertical.
– JouleV
Apr 2 at 7:05
add a comment |
1 Answer
1
active
oldest
votes
You can keep track of which bullet is the longest and set all y-coordinates to that.
begin{enumerate}
item Item 1tikzmark{top 1}
item Item wide wide widetikzmark{bottom 1}
item Item 3tikzmark{top 2}
item Item 4
item Item wide wide wide widetikzmark{longest 2}
item Item 6tikzmark{bottom 2}
end{enumerate}
VerticalBrace[ultra thick, blue]{top 1 -| bottom 1}{bottom 1}{The first two items}
VerticalBrace[ultra thick, blue]{top 2 -| longest 2}{bottom 2 -| longest 2}{The last four items}
1
Very good answer.
– Sebastiano
Apr 2 at 7:20
Splendid! Gracias!
– marya
Apr 2 at 7:25
add a comment |
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%2f482708%2fgrouping-enumerated-list-with-different-width%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can keep track of which bullet is the longest and set all y-coordinates to that.
begin{enumerate}
item Item 1tikzmark{top 1}
item Item wide wide widetikzmark{bottom 1}
item Item 3tikzmark{top 2}
item Item 4
item Item wide wide wide widetikzmark{longest 2}
item Item 6tikzmark{bottom 2}
end{enumerate}
VerticalBrace[ultra thick, blue]{top 1 -| bottom 1}{bottom 1}{The first two items}
VerticalBrace[ultra thick, blue]{top 2 -| longest 2}{bottom 2 -| longest 2}{The last four items}
1
Very good answer.
– Sebastiano
Apr 2 at 7:20
Splendid! Gracias!
– marya
Apr 2 at 7:25
add a comment |
You can keep track of which bullet is the longest and set all y-coordinates to that.
begin{enumerate}
item Item 1tikzmark{top 1}
item Item wide wide widetikzmark{bottom 1}
item Item 3tikzmark{top 2}
item Item 4
item Item wide wide wide widetikzmark{longest 2}
item Item 6tikzmark{bottom 2}
end{enumerate}
VerticalBrace[ultra thick, blue]{top 1 -| bottom 1}{bottom 1}{The first two items}
VerticalBrace[ultra thick, blue]{top 2 -| longest 2}{bottom 2 -| longest 2}{The last four items}
1
Very good answer.
– Sebastiano
Apr 2 at 7:20
Splendid! Gracias!
– marya
Apr 2 at 7:25
add a comment |
You can keep track of which bullet is the longest and set all y-coordinates to that.
begin{enumerate}
item Item 1tikzmark{top 1}
item Item wide wide widetikzmark{bottom 1}
item Item 3tikzmark{top 2}
item Item 4
item Item wide wide wide widetikzmark{longest 2}
item Item 6tikzmark{bottom 2}
end{enumerate}
VerticalBrace[ultra thick, blue]{top 1 -| bottom 1}{bottom 1}{The first two items}
VerticalBrace[ultra thick, blue]{top 2 -| longest 2}{bottom 2 -| longest 2}{The last four items}
You can keep track of which bullet is the longest and set all y-coordinates to that.
begin{enumerate}
item Item 1tikzmark{top 1}
item Item wide wide widetikzmark{bottom 1}
item Item 3tikzmark{top 2}
item Item 4
item Item wide wide wide widetikzmark{longest 2}
item Item 6tikzmark{bottom 2}
end{enumerate}
VerticalBrace[ultra thick, blue]{top 1 -| bottom 1}{bottom 1}{The first two items}
VerticalBrace[ultra thick, blue]{top 2 -| longest 2}{bottom 2 -| longest 2}{The last four items}
answered Apr 2 at 7:18
StefanHStefanH
10.9k1920
10.9k1920
1
Very good answer.
– Sebastiano
Apr 2 at 7:20
Splendid! Gracias!
– marya
Apr 2 at 7:25
add a comment |
1
Very good answer.
– Sebastiano
Apr 2 at 7:20
Splendid! Gracias!
– marya
Apr 2 at 7:25
1
1
Very good answer.
– Sebastiano
Apr 2 at 7:20
Very good answer.
– Sebastiano
Apr 2 at 7:20
Splendid! Gracias!
– marya
Apr 2 at 7:25
Splendid! Gracias!
– marya
Apr 2 at 7:25
add a comment |
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%2f482708%2fgrouping-enumerated-list-with-different-width%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
It might not be a good solution at the first glance, but did you try to add some extra space to shorter items with
hspace
?– Majid Abdolshah
Apr 2 at 6:44
@MajidAbdolshah It will certainly make ugly braces. It is very hard to make the braces absolutely vertical.
– JouleV
Apr 2 at 7:05