I am trying to use a Datatable in order to place a Datatable and a tikz figure next to each other, while aligned vertically in the middle. The alignment seem to work nicely but in screen rendering, but not in hardcopy. In hardcopy the top of the table starts in the middle of the figure. I am not sure how to fix this. The sample code is below.
DOCUMENT();
loadMacros(
"PGstandard.pl",
"PGML.pl",
"PGcourse.pl",
"niceTables.pl",
"PGtikz.pl"
);
$graph_image = createTikZImage();
$graph_image->texPackages(["pgfplots"]);
$graph_image->addToPreamble("\usepgfplotslibrary{fillbetween}");
$graph_image->BEGIN_TIKZ
\begin{axis}[
grid=both,
xmin=-4, xmax=4,
ymin=-7, ymax=7,
xtick distance=1, ytick distance=1,
axis lines = middle, xlabel=\(x\),ylabel=\(y\)
]
\end{axis}
END_TIKZ
BEGIN_PGML
Sketch the graph of a function that has the following table of values:
[@ DataTable([
[ PGML("[@ DataTable([
[[PGML('[`x`]'), headerrow => 1], PGML('[`f(x)`]')],
[PGML('[`-2`]'), PGML('[`0.5`]')],
[PGML('[`-1`]'), PGML('[`2.5`]')],
[PGML('[`0`]'), PGML('[`1`]')],
[PGML('[`1`]'), PGML('[`-1`]')],
[PGML('[`2`]'), PGML('[`-3.5`]')],
], align => '|c|c|', horizontalrules => 1);
@]*"),
PGML(' [@ image($graph_image, width => 300, tex_size => 300) @]*')]
], allcellcss => 'vertical-align: middle; ') @]*
END_PGML
ENDDOCUMENT();