Nested ellipses in tikzpicture: Chomsky hierarchy
I'd like to draw the Chomsky hierarchy using tikz
, similar to:
I have the following so far, for a subset of the hierarchy:
documentclass[11pt]{article}
usepackage{tikz}
usetikzlibrary{shapes,arrows,calc}
% ----------
begin{document}
begin{tikzpicture}
tikzstyle{venn} = [ellipse, minimum height=3em, minimum width=12em, draw]
node [venn] (cs) at (0, $re.south$) {Context Sensitive};
node [venn, minimum height=10em] (re) at (0,0) {Recursively Enumerable};
end{tikzpicture}
end{document}
How can I:
Anchor all of the shapes to the same point in the centre at the bottom of the diagram?
Align the text to the top of each ellipse - is
shift
appropriate here?
tikz-pgf shapes
add a comment |
I'd like to draw the Chomsky hierarchy using tikz
, similar to:
I have the following so far, for a subset of the hierarchy:
documentclass[11pt]{article}
usepackage{tikz}
usetikzlibrary{shapes,arrows,calc}
% ----------
begin{document}
begin{tikzpicture}
tikzstyle{venn} = [ellipse, minimum height=3em, minimum width=12em, draw]
node [venn] (cs) at (0, $re.south$) {Context Sensitive};
node [venn, minimum height=10em] (re) at (0,0) {Recursively Enumerable};
end{tikzpicture}
end{document}
How can I:
Anchor all of the shapes to the same point in the centre at the bottom of the diagram?
Align the text to the top of each ellipse - is
shift
appropriate here?
tikz-pgf shapes
add a comment |
I'd like to draw the Chomsky hierarchy using tikz
, similar to:
I have the following so far, for a subset of the hierarchy:
documentclass[11pt]{article}
usepackage{tikz}
usetikzlibrary{shapes,arrows,calc}
% ----------
begin{document}
begin{tikzpicture}
tikzstyle{venn} = [ellipse, minimum height=3em, minimum width=12em, draw]
node [venn] (cs) at (0, $re.south$) {Context Sensitive};
node [venn, minimum height=10em] (re) at (0,0) {Recursively Enumerable};
end{tikzpicture}
end{document}
How can I:
Anchor all of the shapes to the same point in the centre at the bottom of the diagram?
Align the text to the top of each ellipse - is
shift
appropriate here?
tikz-pgf shapes
I'd like to draw the Chomsky hierarchy using tikz
, similar to:
I have the following so far, for a subset of the hierarchy:
documentclass[11pt]{article}
usepackage{tikz}
usetikzlibrary{shapes,arrows,calc}
% ----------
begin{document}
begin{tikzpicture}
tikzstyle{venn} = [ellipse, minimum height=3em, minimum width=12em, draw]
node [venn] (cs) at (0, $re.south$) {Context Sensitive};
node [venn, minimum height=10em] (re) at (0,0) {Recursively Enumerable};
end{tikzpicture}
end{document}
How can I:
Anchor all of the shapes to the same point in the centre at the bottom of the diagram?
Align the text to the top of each ellipse - is
shift
appropriate here?
tikz-pgf shapes
tikz-pgf shapes
asked 5 hours ago
Adam WilliamsAdam Williams
20416
20416
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
This is not a perfect solution, but it fits this particular case: write words above another node.
documentclass[tikz]{standalone}
usetikzlibrary{shapes}
begin{document}
begin{tikzpicture}
node[above,ellipse,minimum height=2em,minimum width=4em,draw] (a) {regular};
node[above,ellipse,minimum height=4em,minimum width=8em,draw] (b) {};
node[above,ellipse,minimum height=6em,minimum width=12em,draw] (c) {};
node[above,ellipse,minimum height=8em,minimum width=16em,draw] (d) {};
path (a.north) node[above] {context-free}
(b.north) node[above] {context-sensitive}
(c.north) node[above] {recursively enumerable};
end{tikzpicture}
end{document}
add a comment |
Naively one may think this should be simple with fit
but unfortunately ellipse
fits are not tight by default. (See here for a tighter fit, but my naive attempt to use it did not yield the desired results.) So one may do it differently. Note that this is not absolutely fool-proof but can be made so with more efforts. However, for the case at hand it works.
documentclass[11pt]{article}
usepackage{tikz}
usetikzlibrary{shapes.geometric,calc}
begin{document}
begin{tikzpicture}[font=sffamily]
foreach X [count=Y,remember=Y as LastY] in
{regular,context free,context sensitive,recursively enumerable}
{ifnumY=1
node[ellipse,draw,outer sep=0pt] (F-Y) {X};
else
node[anchor=south] (T-Y) at (F-LastY.north) {X};
path let p1=($([yshift=1ex]T-Y.north)-(F-LastY.south)$),
p2=($(F-1.east)-(F-1.west)$),p3=($(F-1.north)-(F-1.south)$)
in ($([yshift=1ex]T-Y.north)!0.5!(F-LastY.south)$)
node[minimum height=y1,minimum width={y1*x2/y3},
draw,ellipse,inner sep=0pt] (F-Y){};
fi}
end{tikzpicture}
end{document}
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%2f484541%2fnested-ellipses-in-tikzpicture-chomsky-hierarchy%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is not a perfect solution, but it fits this particular case: write words above another node.
documentclass[tikz]{standalone}
usetikzlibrary{shapes}
begin{document}
begin{tikzpicture}
node[above,ellipse,minimum height=2em,minimum width=4em,draw] (a) {regular};
node[above,ellipse,minimum height=4em,minimum width=8em,draw] (b) {};
node[above,ellipse,minimum height=6em,minimum width=12em,draw] (c) {};
node[above,ellipse,minimum height=8em,minimum width=16em,draw] (d) {};
path (a.north) node[above] {context-free}
(b.north) node[above] {context-sensitive}
(c.north) node[above] {recursively enumerable};
end{tikzpicture}
end{document}
add a comment |
This is not a perfect solution, but it fits this particular case: write words above another node.
documentclass[tikz]{standalone}
usetikzlibrary{shapes}
begin{document}
begin{tikzpicture}
node[above,ellipse,minimum height=2em,minimum width=4em,draw] (a) {regular};
node[above,ellipse,minimum height=4em,minimum width=8em,draw] (b) {};
node[above,ellipse,minimum height=6em,minimum width=12em,draw] (c) {};
node[above,ellipse,minimum height=8em,minimum width=16em,draw] (d) {};
path (a.north) node[above] {context-free}
(b.north) node[above] {context-sensitive}
(c.north) node[above] {recursively enumerable};
end{tikzpicture}
end{document}
add a comment |
This is not a perfect solution, but it fits this particular case: write words above another node.
documentclass[tikz]{standalone}
usetikzlibrary{shapes}
begin{document}
begin{tikzpicture}
node[above,ellipse,minimum height=2em,minimum width=4em,draw] (a) {regular};
node[above,ellipse,minimum height=4em,minimum width=8em,draw] (b) {};
node[above,ellipse,minimum height=6em,minimum width=12em,draw] (c) {};
node[above,ellipse,minimum height=8em,minimum width=16em,draw] (d) {};
path (a.north) node[above] {context-free}
(b.north) node[above] {context-sensitive}
(c.north) node[above] {recursively enumerable};
end{tikzpicture}
end{document}
This is not a perfect solution, but it fits this particular case: write words above another node.
documentclass[tikz]{standalone}
usetikzlibrary{shapes}
begin{document}
begin{tikzpicture}
node[above,ellipse,minimum height=2em,minimum width=4em,draw] (a) {regular};
node[above,ellipse,minimum height=4em,minimum width=8em,draw] (b) {};
node[above,ellipse,minimum height=6em,minimum width=12em,draw] (c) {};
node[above,ellipse,minimum height=8em,minimum width=16em,draw] (d) {};
path (a.north) node[above] {context-free}
(b.north) node[above] {context-sensitive}
(c.north) node[above] {recursively enumerable};
end{tikzpicture}
end{document}
answered 5 hours ago
JouleVJouleV
12.8k22663
12.8k22663
add a comment |
add a comment |
Naively one may think this should be simple with fit
but unfortunately ellipse
fits are not tight by default. (See here for a tighter fit, but my naive attempt to use it did not yield the desired results.) So one may do it differently. Note that this is not absolutely fool-proof but can be made so with more efforts. However, for the case at hand it works.
documentclass[11pt]{article}
usepackage{tikz}
usetikzlibrary{shapes.geometric,calc}
begin{document}
begin{tikzpicture}[font=sffamily]
foreach X [count=Y,remember=Y as LastY] in
{regular,context free,context sensitive,recursively enumerable}
{ifnumY=1
node[ellipse,draw,outer sep=0pt] (F-Y) {X};
else
node[anchor=south] (T-Y) at (F-LastY.north) {X};
path let p1=($([yshift=1ex]T-Y.north)-(F-LastY.south)$),
p2=($(F-1.east)-(F-1.west)$),p3=($(F-1.north)-(F-1.south)$)
in ($([yshift=1ex]T-Y.north)!0.5!(F-LastY.south)$)
node[minimum height=y1,minimum width={y1*x2/y3},
draw,ellipse,inner sep=0pt] (F-Y){};
fi}
end{tikzpicture}
end{document}
add a comment |
Naively one may think this should be simple with fit
but unfortunately ellipse
fits are not tight by default. (See here for a tighter fit, but my naive attempt to use it did not yield the desired results.) So one may do it differently. Note that this is not absolutely fool-proof but can be made so with more efforts. However, for the case at hand it works.
documentclass[11pt]{article}
usepackage{tikz}
usetikzlibrary{shapes.geometric,calc}
begin{document}
begin{tikzpicture}[font=sffamily]
foreach X [count=Y,remember=Y as LastY] in
{regular,context free,context sensitive,recursively enumerable}
{ifnumY=1
node[ellipse,draw,outer sep=0pt] (F-Y) {X};
else
node[anchor=south] (T-Y) at (F-LastY.north) {X};
path let p1=($([yshift=1ex]T-Y.north)-(F-LastY.south)$),
p2=($(F-1.east)-(F-1.west)$),p3=($(F-1.north)-(F-1.south)$)
in ($([yshift=1ex]T-Y.north)!0.5!(F-LastY.south)$)
node[minimum height=y1,minimum width={y1*x2/y3},
draw,ellipse,inner sep=0pt] (F-Y){};
fi}
end{tikzpicture}
end{document}
add a comment |
Naively one may think this should be simple with fit
but unfortunately ellipse
fits are not tight by default. (See here for a tighter fit, but my naive attempt to use it did not yield the desired results.) So one may do it differently. Note that this is not absolutely fool-proof but can be made so with more efforts. However, for the case at hand it works.
documentclass[11pt]{article}
usepackage{tikz}
usetikzlibrary{shapes.geometric,calc}
begin{document}
begin{tikzpicture}[font=sffamily]
foreach X [count=Y,remember=Y as LastY] in
{regular,context free,context sensitive,recursively enumerable}
{ifnumY=1
node[ellipse,draw,outer sep=0pt] (F-Y) {X};
else
node[anchor=south] (T-Y) at (F-LastY.north) {X};
path let p1=($([yshift=1ex]T-Y.north)-(F-LastY.south)$),
p2=($(F-1.east)-(F-1.west)$),p3=($(F-1.north)-(F-1.south)$)
in ($([yshift=1ex]T-Y.north)!0.5!(F-LastY.south)$)
node[minimum height=y1,minimum width={y1*x2/y3},
draw,ellipse,inner sep=0pt] (F-Y){};
fi}
end{tikzpicture}
end{document}
Naively one may think this should be simple with fit
but unfortunately ellipse
fits are not tight by default. (See here for a tighter fit, but my naive attempt to use it did not yield the desired results.) So one may do it differently. Note that this is not absolutely fool-proof but can be made so with more efforts. However, for the case at hand it works.
documentclass[11pt]{article}
usepackage{tikz}
usetikzlibrary{shapes.geometric,calc}
begin{document}
begin{tikzpicture}[font=sffamily]
foreach X [count=Y,remember=Y as LastY] in
{regular,context free,context sensitive,recursively enumerable}
{ifnumY=1
node[ellipse,draw,outer sep=0pt] (F-Y) {X};
else
node[anchor=south] (T-Y) at (F-LastY.north) {X};
path let p1=($([yshift=1ex]T-Y.north)-(F-LastY.south)$),
p2=($(F-1.east)-(F-1.west)$),p3=($(F-1.north)-(F-1.south)$)
in ($([yshift=1ex]T-Y.north)!0.5!(F-LastY.south)$)
node[minimum height=y1,minimum width={y1*x2/y3},
draw,ellipse,inner sep=0pt] (F-Y){};
fi}
end{tikzpicture}
end{document}
edited 2 hours ago
answered 4 hours ago
marmotmarmot
117k5150283
117k5150283
add a comment |
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%2f484541%2fnested-ellipses-in-tikzpicture-chomsky-hierarchy%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