Annotating a table with arrowsHow to get multiple multirows in a table?Paragraph column in tabular working...
Why did Gandalf use a sword against the Balrog?
Generate Brainfuck for the numbers 1–255
Visa National - No Exit Stamp From France on Return to the UK
Not going forward with internship interview process
Bitcoin successfully deducted on sender wallet but did not reach receiver wallet
Can a PC use the Levitate spell to avoid movement speed reduction from exhaustion?
Is this n-speak?
0xF1 opcode-prefix on i80286
Heating Margarine in Pan = loss of calories?
How can Radagast come across Gandalf and Thorin's company?
Normalization constant of a planar wave
What is this "Table of astronomy" about?
Am I overreacting to my team leader's unethical requests?
What happens when electrons reach the battery?
Is there a standardised way to check fake news?
Loading military units into ships optimally, using backtracking
On math looking obvious in retrospect
What are the process and practices of requesting for pre-submission peer review from field experts?
Google - OR tools for workforce scheduling problems
Can "être sur" mean "to be about" ?
What are the uses and limitations of Persuasion, Insight, and Deception against other PCs?
Why is the result of ('b'+'a'+ + 'a' + 'a').toLowerCase() 'banana'?
How to remove threat that antivirus program indicates has to be manually deleted?
Can I not use QM-AM inequality to solve this?
Annotating a table with arrows
How to get multiple multirows in a table?Paragraph column in tabular working only in the first columnTabular and grid typesettingWhy do I get an extra white page before my TikZ picture?tabu package - gaps in vertical linesHow to draw a square and its diagonals with arrows?Adding 3 multi-columns upside in a table“Undefined control sequence” Regression table from StataTable error: Missing number treated as zero
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I want to recreate the following table on latex
Here is my MWE
documentclass{article}
usepackage{colortbl}
begin{document}
begin{table}[h]
begin{tabular}{|>{columncolor[gray]{.8}}c|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|}
hline
footnotesize{ $x$ } & 0.900 & 0.990 & 0.999 & 1.000 & 1.001 & 1.010 & 1.100 \ hline
footnotesize{ $f(x)$} & 1.810 & 1.980 & 1.998 & 2.000 & 2.002 & 2.020 & 2.210 \ hline
end{tabular}
end{table}
end{document}
tikz-pgf tables highlighting
add a comment |
I want to recreate the following table on latex
Here is my MWE
documentclass{article}
usepackage{colortbl}
begin{document}
begin{table}[h]
begin{tabular}{|>{columncolor[gray]{.8}}c|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|}
hline
footnotesize{ $x$ } & 0.900 & 0.990 & 0.999 & 1.000 & 1.001 & 1.010 & 1.100 \ hline
footnotesize{ $f(x)$} & 1.810 & 1.980 & 1.998 & 2.000 & 2.002 & 2.020 & 2.210 \ hline
end{tabular}
end{table}
end{document}
tikz-pgf tables highlighting
add a comment |
I want to recreate the following table on latex
Here is my MWE
documentclass{article}
usepackage{colortbl}
begin{document}
begin{table}[h]
begin{tabular}{|>{columncolor[gray]{.8}}c|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|}
hline
footnotesize{ $x$ } & 0.900 & 0.990 & 0.999 & 1.000 & 1.001 & 1.010 & 1.100 \ hline
footnotesize{ $f(x)$} & 1.810 & 1.980 & 1.998 & 2.000 & 2.002 & 2.020 & 2.210 \ hline
end{tabular}
end{table}
end{document}
tikz-pgf tables highlighting
I want to recreate the following table on latex
Here is my MWE
documentclass{article}
usepackage{colortbl}
begin{document}
begin{table}[h]
begin{tabular}{|>{columncolor[gray]{.8}}c|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|}
hline
footnotesize{ $x$ } & 0.900 & 0.990 & 0.999 & 1.000 & 1.001 & 1.010 & 1.100 \ hline
footnotesize{ $f(x)$} & 1.810 & 1.980 & 1.998 & 2.000 & 2.002 & 2.020 & 2.210 \ hline
end{tabular}
end{table}
end{document}
tikz-pgf tables highlighting
tikz-pgf tables highlighting
asked 12 hours ago
maryamarya
1,5503 gold badges10 silver badges27 bronze badges
1,5503 gold badges10 silver badges27 bronze badges
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
You can draw with TikZ.
documentclass[tikz,border=5mm]{standalone}
% put a row of 8 elements
newcommand{putrow}[9]{
path (0,#1) node{#2}
++(0:1) node{#3} ++(0:1) node{#4}
++(0:1) node{#5} ++(0:1) node{#6}
++(0:1) node{#7} ++(0:1) node{#8} ++(0:1) node{#9};
}
begin{document}
begin{tikzpicture}[xscale=1.4,yscale=.6]
begin{scope}[shift={(-.5,.5)}]
fill[cyan!30] (0,0) rectangle +(1,-2);
draw (0,0) grid (8,-2);
end{scope}
begin{scope}[-stealth,magenta,shorten >=.5pt,
every node/.style={midway,scale=.8}]
draw[shift={(90:1)}] (1,0)--(4,0) node[above]{$x$ approaches $1$};
draw[shift={(90:1)}] (7,0)--(4,0) node[above]{$x$ approaches $1$};
draw[shift={(-90:2)}] (1,0)--(4,0) node[below]{$f(x)$ approaches $2$};
draw[shift={(-90:2)}] (7,0)--(4,0) node[below]{$f(x)$ approaches $2$};
end{scope}
putrow{0}{$x$}{0.900}{0.990}{0.999}{1.000}{1.001}{1.010}{1.100}
putrow{-1}{$f(x)$}{1.810}{1.980}{1.998}{2.000}{2.002}{2.020}{2.210}
end{tikzpicture}
end{document}
1
Very nice and perfect. I have appreciated it very much.
– Sebastiano
9 hours ago
add a comment |
Also with tikz
, but now with use of the matrix
library. For arrows, edge labels are employed arrows.meta
and quoted
libraries:
documentclass[tikz,border=5mm]{standalone}
usetikzlibrary{arrows.meta,
matrix,
quotes
}
begin{document}
begin{tikzpicture}[
every edge/.style = {draw, purple, -{Straight Barb[angle=60:2pt 3]}, semithick}, shorten >=1pt,
every edge quoetes/.style = {font=footnotesize}
]
matrix (m) [matrix of math nodes,
nodes = {draw, minimum height=4ex, minimum width=3.3em,
inner sep=0pt, outer sep=0pt, anchor=center},
column sep=-pgflinewidth,
row sep=-pgflinewidth,
column 1/.append style = {nodes={fill=cyan!30}}
]
{
x & 0.900 & 0.990 & 0.999 & 1.000 & 1.001 & 1.010 & 1.100 \
f(x) & 1.810 & 1.980 & 1.998 & 2.000 & 2.002 & 2.020 & 2.210 \
};
draw (m-1-2.north |- m.north) edge["$x$ approaches $1$"] (m-1-5.north |- m.north)
(m-1-8.north |- m.north) edge["$f(x)$ approaches $1$" '] (m-1-5.north |- m.north)
(m-1-2.south |- m.south) edge["$x$ approaches $2$" '] (m-1-5.north |- m.south)
(m-1-8.south |- m.south) edge["$f(x)$ approaches $2$"] (m-1-5.north |- m.south);
end{tikzpicture}
end{document}
add a comment |
I wrote two macros that automatically place the text above or below depending on whether the path goes from left to right or not. valeur
and fromto
Code and result (to be compile twice):
documentclass{article}
usepackage{colortbl}
usepackage{tikz}
definecolor{myviolet}{RGB}{243,29,143}
usetikzlibrary{calc,arrows.meta}
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=myviolet,thick,#1]
($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,myviolet,font=bf]{#4};}
begin{document}
begin{table}[h]
begin{tabular}{|>{columncolor[gray]{.8}}c|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|}
hline
footnotesize{ $x$ } & valeur{a1}{0.900} & 0.990 & 0.999 & valeur{b1}{1.000} & 1.001 & 1.010 & valeur{c1}{1.100} \ hline
footnotesize{ $f(x)$} & valeur{a2}{1.810} & 1.980 & 1.998 & valeur{b2}{2.000} & 2.002 & 2.020 & valeur{c2}{2.210} \ hline
end{tabular}
end{table}
fromto[->] {a1}{b1}{$x$ approaches 1.}
fromto[<-] {b1}{c1}{$x$ approaches 1.}
fromto[<-] {b2}{a2}{$f(x)$ approaches 2.}
fromto[->] {c2}{b2}{$f(x)$ approaches 2.}
end{document}
The two macros:
The first called
valeur
place is a TikZnode
centered on the number from which you want to start or arrive thearrow
;
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
It has two arguments:
- the first
#1
is the name we give to thenode
- the second
#2
is the value of thisnode
.
- the first
the second one called
fromto
draw a line and automatically places the text above or below the line (it could be an arrow).
The principle is the following if the path goes from left to right, the text is placed above the path, otherwise it is placed below.
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=myviolet,thick,#1]
($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,myviolet,font=bf]{#4};}
This macro has 4 arguments:
- the first one
#1
is optional and allows to transmit options to the path
- the second
#2
is the starting point
- the third
#3
is the arrival point
- the fourth
#4
is the text to be positioned
- the first one
For example these code produce:
documentclass{article}
usepackage{tikz}
usetikzlibrary{calc,arrows.meta}
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=black,thick,#1]($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,blue,font=bf]{#4};}
begin{document}
begin{tikzpicture}[remember picture]
node[draw,circle] (A)at(0,0){A};
node[draw,circle] (B) at (7,0){B};
end{tikzpicture}
fromto[] {A}{B}{from A to B: text is above}
fromto[] {B}{A}{from B to A: text is below}
end{document}
Translated with www.DeepL.com/Translator
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%2f503855%2fannotating-a-table-with-arrows%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can draw with TikZ.
documentclass[tikz,border=5mm]{standalone}
% put a row of 8 elements
newcommand{putrow}[9]{
path (0,#1) node{#2}
++(0:1) node{#3} ++(0:1) node{#4}
++(0:1) node{#5} ++(0:1) node{#6}
++(0:1) node{#7} ++(0:1) node{#8} ++(0:1) node{#9};
}
begin{document}
begin{tikzpicture}[xscale=1.4,yscale=.6]
begin{scope}[shift={(-.5,.5)}]
fill[cyan!30] (0,0) rectangle +(1,-2);
draw (0,0) grid (8,-2);
end{scope}
begin{scope}[-stealth,magenta,shorten >=.5pt,
every node/.style={midway,scale=.8}]
draw[shift={(90:1)}] (1,0)--(4,0) node[above]{$x$ approaches $1$};
draw[shift={(90:1)}] (7,0)--(4,0) node[above]{$x$ approaches $1$};
draw[shift={(-90:2)}] (1,0)--(4,0) node[below]{$f(x)$ approaches $2$};
draw[shift={(-90:2)}] (7,0)--(4,0) node[below]{$f(x)$ approaches $2$};
end{scope}
putrow{0}{$x$}{0.900}{0.990}{0.999}{1.000}{1.001}{1.010}{1.100}
putrow{-1}{$f(x)$}{1.810}{1.980}{1.998}{2.000}{2.002}{2.020}{2.210}
end{tikzpicture}
end{document}
1
Very nice and perfect. I have appreciated it very much.
– Sebastiano
9 hours ago
add a comment |
You can draw with TikZ.
documentclass[tikz,border=5mm]{standalone}
% put a row of 8 elements
newcommand{putrow}[9]{
path (0,#1) node{#2}
++(0:1) node{#3} ++(0:1) node{#4}
++(0:1) node{#5} ++(0:1) node{#6}
++(0:1) node{#7} ++(0:1) node{#8} ++(0:1) node{#9};
}
begin{document}
begin{tikzpicture}[xscale=1.4,yscale=.6]
begin{scope}[shift={(-.5,.5)}]
fill[cyan!30] (0,0) rectangle +(1,-2);
draw (0,0) grid (8,-2);
end{scope}
begin{scope}[-stealth,magenta,shorten >=.5pt,
every node/.style={midway,scale=.8}]
draw[shift={(90:1)}] (1,0)--(4,0) node[above]{$x$ approaches $1$};
draw[shift={(90:1)}] (7,0)--(4,0) node[above]{$x$ approaches $1$};
draw[shift={(-90:2)}] (1,0)--(4,0) node[below]{$f(x)$ approaches $2$};
draw[shift={(-90:2)}] (7,0)--(4,0) node[below]{$f(x)$ approaches $2$};
end{scope}
putrow{0}{$x$}{0.900}{0.990}{0.999}{1.000}{1.001}{1.010}{1.100}
putrow{-1}{$f(x)$}{1.810}{1.980}{1.998}{2.000}{2.002}{2.020}{2.210}
end{tikzpicture}
end{document}
1
Very nice and perfect. I have appreciated it very much.
– Sebastiano
9 hours ago
add a comment |
You can draw with TikZ.
documentclass[tikz,border=5mm]{standalone}
% put a row of 8 elements
newcommand{putrow}[9]{
path (0,#1) node{#2}
++(0:1) node{#3} ++(0:1) node{#4}
++(0:1) node{#5} ++(0:1) node{#6}
++(0:1) node{#7} ++(0:1) node{#8} ++(0:1) node{#9};
}
begin{document}
begin{tikzpicture}[xscale=1.4,yscale=.6]
begin{scope}[shift={(-.5,.5)}]
fill[cyan!30] (0,0) rectangle +(1,-2);
draw (0,0) grid (8,-2);
end{scope}
begin{scope}[-stealth,magenta,shorten >=.5pt,
every node/.style={midway,scale=.8}]
draw[shift={(90:1)}] (1,0)--(4,0) node[above]{$x$ approaches $1$};
draw[shift={(90:1)}] (7,0)--(4,0) node[above]{$x$ approaches $1$};
draw[shift={(-90:2)}] (1,0)--(4,0) node[below]{$f(x)$ approaches $2$};
draw[shift={(-90:2)}] (7,0)--(4,0) node[below]{$f(x)$ approaches $2$};
end{scope}
putrow{0}{$x$}{0.900}{0.990}{0.999}{1.000}{1.001}{1.010}{1.100}
putrow{-1}{$f(x)$}{1.810}{1.980}{1.998}{2.000}{2.002}{2.020}{2.210}
end{tikzpicture}
end{document}
You can draw with TikZ.
documentclass[tikz,border=5mm]{standalone}
% put a row of 8 elements
newcommand{putrow}[9]{
path (0,#1) node{#2}
++(0:1) node{#3} ++(0:1) node{#4}
++(0:1) node{#5} ++(0:1) node{#6}
++(0:1) node{#7} ++(0:1) node{#8} ++(0:1) node{#9};
}
begin{document}
begin{tikzpicture}[xscale=1.4,yscale=.6]
begin{scope}[shift={(-.5,.5)}]
fill[cyan!30] (0,0) rectangle +(1,-2);
draw (0,0) grid (8,-2);
end{scope}
begin{scope}[-stealth,magenta,shorten >=.5pt,
every node/.style={midway,scale=.8}]
draw[shift={(90:1)}] (1,0)--(4,0) node[above]{$x$ approaches $1$};
draw[shift={(90:1)}] (7,0)--(4,0) node[above]{$x$ approaches $1$};
draw[shift={(-90:2)}] (1,0)--(4,0) node[below]{$f(x)$ approaches $2$};
draw[shift={(-90:2)}] (7,0)--(4,0) node[below]{$f(x)$ approaches $2$};
end{scope}
putrow{0}{$x$}{0.900}{0.990}{0.999}{1.000}{1.001}{1.010}{1.100}
putrow{-1}{$f(x)$}{1.810}{1.980}{1.998}{2.000}{2.002}{2.020}{2.210}
end{tikzpicture}
end{document}
answered 12 hours ago
Black MildBlack Mild
1,7548 silver badges14 bronze badges
1,7548 silver badges14 bronze badges
1
Very nice and perfect. I have appreciated it very much.
– Sebastiano
9 hours ago
add a comment |
1
Very nice and perfect. I have appreciated it very much.
– Sebastiano
9 hours ago
1
1
Very nice and perfect. I have appreciated it very much.
– Sebastiano
9 hours ago
Very nice and perfect. I have appreciated it very much.
– Sebastiano
9 hours ago
add a comment |
Also with tikz
, but now with use of the matrix
library. For arrows, edge labels are employed arrows.meta
and quoted
libraries:
documentclass[tikz,border=5mm]{standalone}
usetikzlibrary{arrows.meta,
matrix,
quotes
}
begin{document}
begin{tikzpicture}[
every edge/.style = {draw, purple, -{Straight Barb[angle=60:2pt 3]}, semithick}, shorten >=1pt,
every edge quoetes/.style = {font=footnotesize}
]
matrix (m) [matrix of math nodes,
nodes = {draw, minimum height=4ex, minimum width=3.3em,
inner sep=0pt, outer sep=0pt, anchor=center},
column sep=-pgflinewidth,
row sep=-pgflinewidth,
column 1/.append style = {nodes={fill=cyan!30}}
]
{
x & 0.900 & 0.990 & 0.999 & 1.000 & 1.001 & 1.010 & 1.100 \
f(x) & 1.810 & 1.980 & 1.998 & 2.000 & 2.002 & 2.020 & 2.210 \
};
draw (m-1-2.north |- m.north) edge["$x$ approaches $1$"] (m-1-5.north |- m.north)
(m-1-8.north |- m.north) edge["$f(x)$ approaches $1$" '] (m-1-5.north |- m.north)
(m-1-2.south |- m.south) edge["$x$ approaches $2$" '] (m-1-5.north |- m.south)
(m-1-8.south |- m.south) edge["$f(x)$ approaches $2$"] (m-1-5.north |- m.south);
end{tikzpicture}
end{document}
add a comment |
Also with tikz
, but now with use of the matrix
library. For arrows, edge labels are employed arrows.meta
and quoted
libraries:
documentclass[tikz,border=5mm]{standalone}
usetikzlibrary{arrows.meta,
matrix,
quotes
}
begin{document}
begin{tikzpicture}[
every edge/.style = {draw, purple, -{Straight Barb[angle=60:2pt 3]}, semithick}, shorten >=1pt,
every edge quoetes/.style = {font=footnotesize}
]
matrix (m) [matrix of math nodes,
nodes = {draw, minimum height=4ex, minimum width=3.3em,
inner sep=0pt, outer sep=0pt, anchor=center},
column sep=-pgflinewidth,
row sep=-pgflinewidth,
column 1/.append style = {nodes={fill=cyan!30}}
]
{
x & 0.900 & 0.990 & 0.999 & 1.000 & 1.001 & 1.010 & 1.100 \
f(x) & 1.810 & 1.980 & 1.998 & 2.000 & 2.002 & 2.020 & 2.210 \
};
draw (m-1-2.north |- m.north) edge["$x$ approaches $1$"] (m-1-5.north |- m.north)
(m-1-8.north |- m.north) edge["$f(x)$ approaches $1$" '] (m-1-5.north |- m.north)
(m-1-2.south |- m.south) edge["$x$ approaches $2$" '] (m-1-5.north |- m.south)
(m-1-8.south |- m.south) edge["$f(x)$ approaches $2$"] (m-1-5.north |- m.south);
end{tikzpicture}
end{document}
add a comment |
Also with tikz
, but now with use of the matrix
library. For arrows, edge labels are employed arrows.meta
and quoted
libraries:
documentclass[tikz,border=5mm]{standalone}
usetikzlibrary{arrows.meta,
matrix,
quotes
}
begin{document}
begin{tikzpicture}[
every edge/.style = {draw, purple, -{Straight Barb[angle=60:2pt 3]}, semithick}, shorten >=1pt,
every edge quoetes/.style = {font=footnotesize}
]
matrix (m) [matrix of math nodes,
nodes = {draw, minimum height=4ex, minimum width=3.3em,
inner sep=0pt, outer sep=0pt, anchor=center},
column sep=-pgflinewidth,
row sep=-pgflinewidth,
column 1/.append style = {nodes={fill=cyan!30}}
]
{
x & 0.900 & 0.990 & 0.999 & 1.000 & 1.001 & 1.010 & 1.100 \
f(x) & 1.810 & 1.980 & 1.998 & 2.000 & 2.002 & 2.020 & 2.210 \
};
draw (m-1-2.north |- m.north) edge["$x$ approaches $1$"] (m-1-5.north |- m.north)
(m-1-8.north |- m.north) edge["$f(x)$ approaches $1$" '] (m-1-5.north |- m.north)
(m-1-2.south |- m.south) edge["$x$ approaches $2$" '] (m-1-5.north |- m.south)
(m-1-8.south |- m.south) edge["$f(x)$ approaches $2$"] (m-1-5.north |- m.south);
end{tikzpicture}
end{document}
Also with tikz
, but now with use of the matrix
library. For arrows, edge labels are employed arrows.meta
and quoted
libraries:
documentclass[tikz,border=5mm]{standalone}
usetikzlibrary{arrows.meta,
matrix,
quotes
}
begin{document}
begin{tikzpicture}[
every edge/.style = {draw, purple, -{Straight Barb[angle=60:2pt 3]}, semithick}, shorten >=1pt,
every edge quoetes/.style = {font=footnotesize}
]
matrix (m) [matrix of math nodes,
nodes = {draw, minimum height=4ex, minimum width=3.3em,
inner sep=0pt, outer sep=0pt, anchor=center},
column sep=-pgflinewidth,
row sep=-pgflinewidth,
column 1/.append style = {nodes={fill=cyan!30}}
]
{
x & 0.900 & 0.990 & 0.999 & 1.000 & 1.001 & 1.010 & 1.100 \
f(x) & 1.810 & 1.980 & 1.998 & 2.000 & 2.002 & 2.020 & 2.210 \
};
draw (m-1-2.north |- m.north) edge["$x$ approaches $1$"] (m-1-5.north |- m.north)
(m-1-8.north |- m.north) edge["$f(x)$ approaches $1$" '] (m-1-5.north |- m.north)
(m-1-2.south |- m.south) edge["$x$ approaches $2$" '] (m-1-5.north |- m.south)
(m-1-8.south |- m.south) edge["$f(x)$ approaches $2$"] (m-1-5.north |- m.south);
end{tikzpicture}
end{document}
answered 7 hours ago
ZarkoZarko
143k8 gold badges79 silver badges192 bronze badges
143k8 gold badges79 silver badges192 bronze badges
add a comment |
add a comment |
I wrote two macros that automatically place the text above or below depending on whether the path goes from left to right or not. valeur
and fromto
Code and result (to be compile twice):
documentclass{article}
usepackage{colortbl}
usepackage{tikz}
definecolor{myviolet}{RGB}{243,29,143}
usetikzlibrary{calc,arrows.meta}
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=myviolet,thick,#1]
($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,myviolet,font=bf]{#4};}
begin{document}
begin{table}[h]
begin{tabular}{|>{columncolor[gray]{.8}}c|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|}
hline
footnotesize{ $x$ } & valeur{a1}{0.900} & 0.990 & 0.999 & valeur{b1}{1.000} & 1.001 & 1.010 & valeur{c1}{1.100} \ hline
footnotesize{ $f(x)$} & valeur{a2}{1.810} & 1.980 & 1.998 & valeur{b2}{2.000} & 2.002 & 2.020 & valeur{c2}{2.210} \ hline
end{tabular}
end{table}
fromto[->] {a1}{b1}{$x$ approaches 1.}
fromto[<-] {b1}{c1}{$x$ approaches 1.}
fromto[<-] {b2}{a2}{$f(x)$ approaches 2.}
fromto[->] {c2}{b2}{$f(x)$ approaches 2.}
end{document}
The two macros:
The first called
valeur
place is a TikZnode
centered on the number from which you want to start or arrive thearrow
;
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
It has two arguments:
- the first
#1
is the name we give to thenode
- the second
#2
is the value of thisnode
.
- the first
the second one called
fromto
draw a line and automatically places the text above or below the line (it could be an arrow).
The principle is the following if the path goes from left to right, the text is placed above the path, otherwise it is placed below.
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=myviolet,thick,#1]
($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,myviolet,font=bf]{#4};}
This macro has 4 arguments:
- the first one
#1
is optional and allows to transmit options to the path
- the second
#2
is the starting point
- the third
#3
is the arrival point
- the fourth
#4
is the text to be positioned
- the first one
For example these code produce:
documentclass{article}
usepackage{tikz}
usetikzlibrary{calc,arrows.meta}
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=black,thick,#1]($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,blue,font=bf]{#4};}
begin{document}
begin{tikzpicture}[remember picture]
node[draw,circle] (A)at(0,0){A};
node[draw,circle] (B) at (7,0){B};
end{tikzpicture}
fromto[] {A}{B}{from A to B: text is above}
fromto[] {B}{A}{from B to A: text is below}
end{document}
Translated with www.DeepL.com/Translator
add a comment |
I wrote two macros that automatically place the text above or below depending on whether the path goes from left to right or not. valeur
and fromto
Code and result (to be compile twice):
documentclass{article}
usepackage{colortbl}
usepackage{tikz}
definecolor{myviolet}{RGB}{243,29,143}
usetikzlibrary{calc,arrows.meta}
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=myviolet,thick,#1]
($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,myviolet,font=bf]{#4};}
begin{document}
begin{table}[h]
begin{tabular}{|>{columncolor[gray]{.8}}c|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|}
hline
footnotesize{ $x$ } & valeur{a1}{0.900} & 0.990 & 0.999 & valeur{b1}{1.000} & 1.001 & 1.010 & valeur{c1}{1.100} \ hline
footnotesize{ $f(x)$} & valeur{a2}{1.810} & 1.980 & 1.998 & valeur{b2}{2.000} & 2.002 & 2.020 & valeur{c2}{2.210} \ hline
end{tabular}
end{table}
fromto[->] {a1}{b1}{$x$ approaches 1.}
fromto[<-] {b1}{c1}{$x$ approaches 1.}
fromto[<-] {b2}{a2}{$f(x)$ approaches 2.}
fromto[->] {c2}{b2}{$f(x)$ approaches 2.}
end{document}
The two macros:
The first called
valeur
place is a TikZnode
centered on the number from which you want to start or arrive thearrow
;
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
It has two arguments:
- the first
#1
is the name we give to thenode
- the second
#2
is the value of thisnode
.
- the first
the second one called
fromto
draw a line and automatically places the text above or below the line (it could be an arrow).
The principle is the following if the path goes from left to right, the text is placed above the path, otherwise it is placed below.
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=myviolet,thick,#1]
($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,myviolet,font=bf]{#4};}
This macro has 4 arguments:
- the first one
#1
is optional and allows to transmit options to the path
- the second
#2
is the starting point
- the third
#3
is the arrival point
- the fourth
#4
is the text to be positioned
- the first one
For example these code produce:
documentclass{article}
usepackage{tikz}
usetikzlibrary{calc,arrows.meta}
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=black,thick,#1]($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,blue,font=bf]{#4};}
begin{document}
begin{tikzpicture}[remember picture]
node[draw,circle] (A)at(0,0){A};
node[draw,circle] (B) at (7,0){B};
end{tikzpicture}
fromto[] {A}{B}{from A to B: text is above}
fromto[] {B}{A}{from B to A: text is below}
end{document}
Translated with www.DeepL.com/Translator
add a comment |
I wrote two macros that automatically place the text above or below depending on whether the path goes from left to right or not. valeur
and fromto
Code and result (to be compile twice):
documentclass{article}
usepackage{colortbl}
usepackage{tikz}
definecolor{myviolet}{RGB}{243,29,143}
usetikzlibrary{calc,arrows.meta}
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=myviolet,thick,#1]
($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,myviolet,font=bf]{#4};}
begin{document}
begin{table}[h]
begin{tabular}{|>{columncolor[gray]{.8}}c|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|}
hline
footnotesize{ $x$ } & valeur{a1}{0.900} & 0.990 & 0.999 & valeur{b1}{1.000} & 1.001 & 1.010 & valeur{c1}{1.100} \ hline
footnotesize{ $f(x)$} & valeur{a2}{1.810} & 1.980 & 1.998 & valeur{b2}{2.000} & 2.002 & 2.020 & valeur{c2}{2.210} \ hline
end{tabular}
end{table}
fromto[->] {a1}{b1}{$x$ approaches 1.}
fromto[<-] {b1}{c1}{$x$ approaches 1.}
fromto[<-] {b2}{a2}{$f(x)$ approaches 2.}
fromto[->] {c2}{b2}{$f(x)$ approaches 2.}
end{document}
The two macros:
The first called
valeur
place is a TikZnode
centered on the number from which you want to start or arrive thearrow
;
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
It has two arguments:
- the first
#1
is the name we give to thenode
- the second
#2
is the value of thisnode
.
- the first
the second one called
fromto
draw a line and automatically places the text above or below the line (it could be an arrow).
The principle is the following if the path goes from left to right, the text is placed above the path, otherwise it is placed below.
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=myviolet,thick,#1]
($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,myviolet,font=bf]{#4};}
This macro has 4 arguments:
- the first one
#1
is optional and allows to transmit options to the path
- the second
#2
is the starting point
- the third
#3
is the arrival point
- the fourth
#4
is the text to be positioned
- the first one
For example these code produce:
documentclass{article}
usepackage{tikz}
usetikzlibrary{calc,arrows.meta}
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=black,thick,#1]($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,blue,font=bf]{#4};}
begin{document}
begin{tikzpicture}[remember picture]
node[draw,circle] (A)at(0,0){A};
node[draw,circle] (B) at (7,0){B};
end{tikzpicture}
fromto[] {A}{B}{from A to B: text is above}
fromto[] {B}{A}{from B to A: text is below}
end{document}
Translated with www.DeepL.com/Translator
I wrote two macros that automatically place the text above or below depending on whether the path goes from left to right or not. valeur
and fromto
Code and result (to be compile twice):
documentclass{article}
usepackage{colortbl}
usepackage{tikz}
definecolor{myviolet}{RGB}{243,29,143}
usetikzlibrary{calc,arrows.meta}
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=myviolet,thick,#1]
($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,myviolet,font=bf]{#4};}
begin{document}
begin{table}[h]
begin{tabular}{|>{columncolor[gray]{.8}}c|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|}
hline
footnotesize{ $x$ } & valeur{a1}{0.900} & 0.990 & 0.999 & valeur{b1}{1.000} & 1.001 & 1.010 & valeur{c1}{1.100} \ hline
footnotesize{ $f(x)$} & valeur{a2}{1.810} & 1.980 & 1.998 & valeur{b2}{2.000} & 2.002 & 2.020 & valeur{c2}{2.210} \ hline
end{tabular}
end{table}
fromto[->] {a1}{b1}{$x$ approaches 1.}
fromto[<-] {b1}{c1}{$x$ approaches 1.}
fromto[<-] {b2}{a2}{$f(x)$ approaches 2.}
fromto[->] {c2}{b2}{$f(x)$ approaches 2.}
end{document}
The two macros:
The first called
valeur
place is a TikZnode
centered on the number from which you want to start or arrive thearrow
;
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
It has two arguments:
- the first
#1
is the name we give to thenode
- the second
#2
is the value of thisnode
.
- the first
the second one called
fromto
draw a line and automatically places the text above or below the line (it could be an arrow).
The principle is the following if the path goes from left to right, the text is placed above the path, otherwise it is placed below.
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=myviolet,thick,#1]
($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,myviolet,font=bf]{#4};}
This macro has 4 arguments:
- the first one
#1
is optional and allows to transmit options to the path
- the second
#2
is the starting point
- the third
#3
is the arrival point
- the fourth
#4
is the text to be positioned
- the first one
For example these code produce:
documentclass{article}
usepackage{tikz}
usetikzlibrary{calc,arrows.meta}
newcommand{valeur}[2]{
tikz[remember picture] node[inner sep=0pt,anchor=center](#1){#2};}
newcommand{fromto}[4][]{
tikz[remember picture,overlay,auto=left,>={Stealth[length=5pt, inset=1pt,sep]}]
path[draw=black,thick,#1]($(#2.center)!5mm!90:(#3.center)$)--($(#3.center)!5mm!-90:(#2.center)$)node[midway,blue,font=bf]{#4};}
begin{document}
begin{tikzpicture}[remember picture]
node[draw,circle] (A)at(0,0){A};
node[draw,circle] (B) at (7,0){B};
end{tikzpicture}
fromto[] {A}{B}{from A to B: text is above}
fromto[] {B}{A}{from B to A: text is below}
end{document}
Translated with www.DeepL.com/Translator
answered 36 mins ago
AndréCAndréC
12.2k2 gold badges17 silver badges53 bronze badges
12.2k2 gold badges17 silver badges53 bronze badges
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%2f503855%2fannotating-a-table-with-arrows%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