How to have a second level of labels on x-axis
up vote
4
down vote
favorite
This is so basic, I'm kind of embarrassed, but I'm trying to add fractions on a number line and it looks like crap. Is there a way to drop fractions to a different level or something. I tried [below left]but that didn't look right either. Looking for something like [below below] to double up the drop, but I couldn't find an answer anywhere.
documentclass[letter]{article}
usepackage[english]{babel}
usepackage[margin=1in]{geometry}
usepackage{amsmath}
usepackage{tikz}
begin{document}
begin{center}
begin{tikzpicture}
draw[latex-latex] (-1.5,0) -- (5.5,0);% the x-axis
foreach x in {-1,...,5} % tick marks
draw (x,0) -- (x,-3pt);
foreach x in {-1,...,5} % the numbers
node [below] at (x,-0.1) {$x$};
node [above] at (1.67,0.5) {A};
node [below] at (1.67,-0) {1$frac{2}{3}$};
end{tikzpicture}
end{center}
end{document}

tikz-pgf
bumped to the homepage by Community♦ 6 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
up vote
4
down vote
favorite
This is so basic, I'm kind of embarrassed, but I'm trying to add fractions on a number line and it looks like crap. Is there a way to drop fractions to a different level or something. I tried [below left]but that didn't look right either. Looking for something like [below below] to double up the drop, but I couldn't find an answer anywhere.
documentclass[letter]{article}
usepackage[english]{babel}
usepackage[margin=1in]{geometry}
usepackage{amsmath}
usepackage{tikz}
begin{document}
begin{center}
begin{tikzpicture}
draw[latex-latex] (-1.5,0) -- (5.5,0);% the x-axis
foreach x in {-1,...,5} % tick marks
draw (x,0) -- (x,-3pt);
foreach x in {-1,...,5} % the numbers
node [below] at (x,-0.1) {$x$};
node [above] at (1.67,0.5) {A};
node [below] at (1.67,-0) {1$frac{2}{3}$};
end{tikzpicture}
end{center}
end{document}

tikz-pgf
bumped to the homepage by Community♦ 6 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
3
Welcome to TeX.SE! Yes, of course, there are advanced positioning methods available, e.g. when you loadusetikzlibrary{positioning}. And you could donode [below=5pt] at (1.67,-0) {1$frac{2}{3}$};, but IMHOnode [below=5pt] at (1.67,-0) {$frac{5}{3}$};looks better. If you load thefppackage and thefputikz library, you could also do something likepgfmathprintnumber[frac]{0.5}.
– marmot
Aug 31 at 2:18
Thank you so much! Works perfectly. I'm going to go read up on these packages.
– Benjamin Compson
Aug 31 at 23:30
I fixed some problems in the code and markup of your post. I think you had the code selected when you added the image. As a result, the code was used as the alt text for the image (as far as the markup was concerned), and when you do that all[and]in the code are changed to[and], respectively. I.e. the brackets in the code are escaped, so they don't interfere with the brackets in the markdown code for image inclusion (that looks like[![alt text][1]][1], selected text will be used asalt text).
– Torbjørn T.
Sep 2 at 6:36
@marmot Do you want to post this as an answer so that the question can be closed?
– Andrew
Oct 9 at 23:43
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
This is so basic, I'm kind of embarrassed, but I'm trying to add fractions on a number line and it looks like crap. Is there a way to drop fractions to a different level or something. I tried [below left]but that didn't look right either. Looking for something like [below below] to double up the drop, but I couldn't find an answer anywhere.
documentclass[letter]{article}
usepackage[english]{babel}
usepackage[margin=1in]{geometry}
usepackage{amsmath}
usepackage{tikz}
begin{document}
begin{center}
begin{tikzpicture}
draw[latex-latex] (-1.5,0) -- (5.5,0);% the x-axis
foreach x in {-1,...,5} % tick marks
draw (x,0) -- (x,-3pt);
foreach x in {-1,...,5} % the numbers
node [below] at (x,-0.1) {$x$};
node [above] at (1.67,0.5) {A};
node [below] at (1.67,-0) {1$frac{2}{3}$};
end{tikzpicture}
end{center}
end{document}

tikz-pgf
This is so basic, I'm kind of embarrassed, but I'm trying to add fractions on a number line and it looks like crap. Is there a way to drop fractions to a different level or something. I tried [below left]but that didn't look right either. Looking for something like [below below] to double up the drop, but I couldn't find an answer anywhere.
documentclass[letter]{article}
usepackage[english]{babel}
usepackage[margin=1in]{geometry}
usepackage{amsmath}
usepackage{tikz}
begin{document}
begin{center}
begin{tikzpicture}
draw[latex-latex] (-1.5,0) -- (5.5,0);% the x-axis
foreach x in {-1,...,5} % tick marks
draw (x,0) -- (x,-3pt);
foreach x in {-1,...,5} % the numbers
node [below] at (x,-0.1) {$x$};
node [above] at (1.67,0.5) {A};
node [below] at (1.67,-0) {1$frac{2}{3}$};
end{tikzpicture}
end{center}
end{document}

tikz-pgf
tikz-pgf
edited Sep 2 at 6:31
Torbjørn T.
154k13245433
154k13245433
asked Aug 31 at 2:10
Benjamin Compson
623
623
bumped to the homepage by Community♦ 6 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 6 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
3
Welcome to TeX.SE! Yes, of course, there are advanced positioning methods available, e.g. when you loadusetikzlibrary{positioning}. And you could donode [below=5pt] at (1.67,-0) {1$frac{2}{3}$};, but IMHOnode [below=5pt] at (1.67,-0) {$frac{5}{3}$};looks better. If you load thefppackage and thefputikz library, you could also do something likepgfmathprintnumber[frac]{0.5}.
– marmot
Aug 31 at 2:18
Thank you so much! Works perfectly. I'm going to go read up on these packages.
– Benjamin Compson
Aug 31 at 23:30
I fixed some problems in the code and markup of your post. I think you had the code selected when you added the image. As a result, the code was used as the alt text for the image (as far as the markup was concerned), and when you do that all[and]in the code are changed to[and], respectively. I.e. the brackets in the code are escaped, so they don't interfere with the brackets in the markdown code for image inclusion (that looks like[![alt text][1]][1], selected text will be used asalt text).
– Torbjørn T.
Sep 2 at 6:36
@marmot Do you want to post this as an answer so that the question can be closed?
– Andrew
Oct 9 at 23:43
add a comment |
3
Welcome to TeX.SE! Yes, of course, there are advanced positioning methods available, e.g. when you loadusetikzlibrary{positioning}. And you could donode [below=5pt] at (1.67,-0) {1$frac{2}{3}$};, but IMHOnode [below=5pt] at (1.67,-0) {$frac{5}{3}$};looks better. If you load thefppackage and thefputikz library, you could also do something likepgfmathprintnumber[frac]{0.5}.
– marmot
Aug 31 at 2:18
Thank you so much! Works perfectly. I'm going to go read up on these packages.
– Benjamin Compson
Aug 31 at 23:30
I fixed some problems in the code and markup of your post. I think you had the code selected when you added the image. As a result, the code was used as the alt text for the image (as far as the markup was concerned), and when you do that all[and]in the code are changed to[and], respectively. I.e. the brackets in the code are escaped, so they don't interfere with the brackets in the markdown code for image inclusion (that looks like[![alt text][1]][1], selected text will be used asalt text).
– Torbjørn T.
Sep 2 at 6:36
@marmot Do you want to post this as an answer so that the question can be closed?
– Andrew
Oct 9 at 23:43
3
3
Welcome to TeX.SE! Yes, of course, there are advanced positioning methods available, e.g. when you load
usetikzlibrary{positioning}. And you could do node [below=5pt] at (1.67,-0) {1$frac{2}{3}$};, but IMHO node [below=5pt] at (1.67,-0) {$frac{5}{3}$}; looks better. If you load the fp package and the fpu tikz library, you could also do something like pgfmathprintnumber[frac]{0.5}.– marmot
Aug 31 at 2:18
Welcome to TeX.SE! Yes, of course, there are advanced positioning methods available, e.g. when you load
usetikzlibrary{positioning}. And you could do node [below=5pt] at (1.67,-0) {1$frac{2}{3}$};, but IMHO node [below=5pt] at (1.67,-0) {$frac{5}{3}$}; looks better. If you load the fp package and the fpu tikz library, you could also do something like pgfmathprintnumber[frac]{0.5}.– marmot
Aug 31 at 2:18
Thank you so much! Works perfectly. I'm going to go read up on these packages.
– Benjamin Compson
Aug 31 at 23:30
Thank you so much! Works perfectly. I'm going to go read up on these packages.
– Benjamin Compson
Aug 31 at 23:30
I fixed some problems in the code and markup of your post. I think you had the code selected when you added the image. As a result, the code was used as the alt text for the image (as far as the markup was concerned), and when you do that all
[ and ] in the code are changed to [ and ], respectively. I.e. the brackets in the code are escaped, so they don't interfere with the brackets in the markdown code for image inclusion (that looks like [![alt text][1]][1], selected text will be used as alt text).– Torbjørn T.
Sep 2 at 6:36
I fixed some problems in the code and markup of your post. I think you had the code selected when you added the image. As a result, the code was used as the alt text for the image (as far as the markup was concerned), and when you do that all
[ and ] in the code are changed to [ and ], respectively. I.e. the brackets in the code are escaped, so they don't interfere with the brackets in the markdown code for image inclusion (that looks like [![alt text][1]][1], selected text will be used as alt text).– Torbjørn T.
Sep 2 at 6:36
@marmot Do you want to post this as an answer so that the question can be closed?
– Andrew
Oct 9 at 23:43
@marmot Do you want to post this as an answer so that the question can be closed?
– Andrew
Oct 9 at 23:43
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Towards an answer ... don't know precisely what you want... positioning allows, as its name suggest, for an intuitive positioning. It also helps to work with the anchor=base key in this case, I'd say.
documentclass[letter]{article}
usepackage[english]{babel}
usepackage[margin=1in]{geometry}
usepackage{amsmath}
usepackage{tikz}
usetikzlibrary{positioning}
begin{document}
begin{center}
begin{tikzpicture}
draw[latex-latex] (-1.5,0) -- (5.5,0);% the x-axis
foreach x in {-1,...,5} % tick marks
draw (x,0) -- (x,-3pt);
foreach x in {-1,...,5} % the numbers
{node [below=12pt,anchor=base] at (x,0) {$x$};}
node [above=12pt,anchor=base] at (5/3,0) {A};
node [below=12pt,anchor=base] at (5/3,-0) {$frac{5}{3}$};
end{tikzpicture}
end{center}
end{document}

add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Towards an answer ... don't know precisely what you want... positioning allows, as its name suggest, for an intuitive positioning. It also helps to work with the anchor=base key in this case, I'd say.
documentclass[letter]{article}
usepackage[english]{babel}
usepackage[margin=1in]{geometry}
usepackage{amsmath}
usepackage{tikz}
usetikzlibrary{positioning}
begin{document}
begin{center}
begin{tikzpicture}
draw[latex-latex] (-1.5,0) -- (5.5,0);% the x-axis
foreach x in {-1,...,5} % tick marks
draw (x,0) -- (x,-3pt);
foreach x in {-1,...,5} % the numbers
{node [below=12pt,anchor=base] at (x,0) {$x$};}
node [above=12pt,anchor=base] at (5/3,0) {A};
node [below=12pt,anchor=base] at (5/3,-0) {$frac{5}{3}$};
end{tikzpicture}
end{center}
end{document}

add a comment |
up vote
0
down vote
Towards an answer ... don't know precisely what you want... positioning allows, as its name suggest, for an intuitive positioning. It also helps to work with the anchor=base key in this case, I'd say.
documentclass[letter]{article}
usepackage[english]{babel}
usepackage[margin=1in]{geometry}
usepackage{amsmath}
usepackage{tikz}
usetikzlibrary{positioning}
begin{document}
begin{center}
begin{tikzpicture}
draw[latex-latex] (-1.5,0) -- (5.5,0);% the x-axis
foreach x in {-1,...,5} % tick marks
draw (x,0) -- (x,-3pt);
foreach x in {-1,...,5} % the numbers
{node [below=12pt,anchor=base] at (x,0) {$x$};}
node [above=12pt,anchor=base] at (5/3,0) {A};
node [below=12pt,anchor=base] at (5/3,-0) {$frac{5}{3}$};
end{tikzpicture}
end{center}
end{document}

add a comment |
up vote
0
down vote
up vote
0
down vote
Towards an answer ... don't know precisely what you want... positioning allows, as its name suggest, for an intuitive positioning. It also helps to work with the anchor=base key in this case, I'd say.
documentclass[letter]{article}
usepackage[english]{babel}
usepackage[margin=1in]{geometry}
usepackage{amsmath}
usepackage{tikz}
usetikzlibrary{positioning}
begin{document}
begin{center}
begin{tikzpicture}
draw[latex-latex] (-1.5,0) -- (5.5,0);% the x-axis
foreach x in {-1,...,5} % tick marks
draw (x,0) -- (x,-3pt);
foreach x in {-1,...,5} % the numbers
{node [below=12pt,anchor=base] at (x,0) {$x$};}
node [above=12pt,anchor=base] at (5/3,0) {A};
node [below=12pt,anchor=base] at (5/3,-0) {$frac{5}{3}$};
end{tikzpicture}
end{center}
end{document}

Towards an answer ... don't know precisely what you want... positioning allows, as its name suggest, for an intuitive positioning. It also helps to work with the anchor=base key in this case, I'd say.
documentclass[letter]{article}
usepackage[english]{babel}
usepackage[margin=1in]{geometry}
usepackage{amsmath}
usepackage{tikz}
usetikzlibrary{positioning}
begin{document}
begin{center}
begin{tikzpicture}
draw[latex-latex] (-1.5,0) -- (5.5,0);% the x-axis
foreach x in {-1,...,5} % tick marks
draw (x,0) -- (x,-3pt);
foreach x in {-1,...,5} % the numbers
{node [below=12pt,anchor=base] at (x,0) {$x$};}
node [above=12pt,anchor=base] at (5/3,0) {A};
node [below=12pt,anchor=base] at (5/3,-0) {$frac{5}{3}$};
end{tikzpicture}
end{center}
end{document}

answered Oct 10 at 0:37
marmot
81.4k491174
81.4k491174
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f448600%2fhow-to-have-a-second-level-of-labels-on-x-axis%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
3
Welcome to TeX.SE! Yes, of course, there are advanced positioning methods available, e.g. when you load
usetikzlibrary{positioning}. And you could donode [below=5pt] at (1.67,-0) {1$frac{2}{3}$};, but IMHOnode [below=5pt] at (1.67,-0) {$frac{5}{3}$};looks better. If you load thefppackage and thefputikz library, you could also do something likepgfmathprintnumber[frac]{0.5}.– marmot
Aug 31 at 2:18
Thank you so much! Works perfectly. I'm going to go read up on these packages.
– Benjamin Compson
Aug 31 at 23:30
I fixed some problems in the code and markup of your post. I think you had the code selected when you added the image. As a result, the code was used as the alt text for the image (as far as the markup was concerned), and when you do that all
[and]in the code are changed to[and], respectively. I.e. the brackets in the code are escaped, so they don't interfere with the brackets in the markdown code for image inclusion (that looks like[![alt text][1]][1], selected text will be used asalt text).– Torbjørn T.
Sep 2 at 6:36
@marmot Do you want to post this as an answer so that the question can be closed?
– Andrew
Oct 9 at 23:43