我怎样才能删除 tikzpicture 上方和左侧的空间?
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[margin=3cm]{geometry}
\usepackage{tabularx}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.6,my style/.append style = {axis lines = middle, xlabel = {$x$}, x label style = {anchor = north west}, ylabel = {$y$}, y label style = {anchor = south east}, minor grid style = gray!20, scale mode = scale uniformly}}
\pgfplotsset{compat=1.5.1}
\begin{document}
\begin{center}
\begin{tabularx}{\textwidth}{>{\hsize=1.2\hsize}X|>{\hsize=0.8\hsize}X|>{\hsize=1.2\hsize}X|>{\hsize=0.8\hsize}X}
\multicolumn{2}{>{\hsize=2\hsize}X|}{$f$ ist in $\mathopen[0,3\mathclose]$ \textbf{linksgekrümmt} (oder \textbf{konvex})} & \multicolumn{2}{>{\hsize=2\hsize}X}{$g$ ist in $\mathopen[0,3\mathclose]$ \textbf{rechtsgekrümmt} (oder \textbf{konkav}) } \\
\hline
\begin{tikzpicture}[baseline=(current bounding box.north)]
\begin{axis}[
scale=0.5,
my style,
grid=both,
minor x tick num=1,
xmin=-0.2, xmax=3.2,
minor y tick num=1,
ymin = -1.7, ymax = 1.7
]
\addplot[draw=blue,domain=0:3,samples=100]{4/9*(x-1.5)^2-1/2}node[left,blue]{$f$};
\end{axis}
\end{tikzpicture}
&
Die Tangentensteigungen von $f$ in $\mathopen[a,b\mathclose]$ werden grösser.
&
\begin{tikzpicture}[baseline=(current bounding box.north)]
\begin{axis}[
scale=0.5,
my style,
grid=both,
minor x tick num=1,
xmin=-0.2, xmax=3.2,
minor y tick num=1,
ymin = -1.7, ymax = 1.7
]
\addplot[draw=blue,domain=0:3,samples=100]{-4/9*(x-1.5)^2+1/2}node[left,below,blue]{$g$};
\end{axis}
\end{tikzpicture}
&
Die Tangentensteigungen von $g$ in $\mathopen[a,b\mathclose]$ werden kleiner.\\
\hline
\end{tabularx}
\end{center}
\end{document}
答案1
x 和 y
tick label
将字体大小缩小到scriptsize
删除第一列左侧的空格
@{}
使用
baseline = center
使用
makecell
包拆分第 2 列和第 4 列使用
xshift
和yshift
将标签移近轴
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[margin=3cm]{geometry}
\usepackage{tabularx}
\usepackage{tikz,makecell}
\usepackage{pgfplots}
\pgfplotsset{compat=1.6,my style/.append style = {axis lines = middle, xlabel = {$x$}, x label style = {anchor = north west}, ylabel = {$y$}, y label style = {anchor = south east}, minor grid style = gray!20, scale mode = scale uniformly}}
\pgfplotsset{compat=1.5.1}
\pgfplotsset{every x tick label/.append style={font=\scriptsize, yshift=0.7ex}}
\pgfplotsset{every y tick label/.append style={font=\scriptsize, xshift=0.5ex}}
\begin{document}
\noindent
\begin{tabular}{@{}cccc}
\multicolumn{2}{l}{\footnotesize $f$ ist in $\mathopen[0,3\mathclose]$ \textbf{linksgekrümmt} (oder \textbf{konvex})}
& \multicolumn{2}{l}{\footnotesize $g$ ist in $\mathopen[0,3\mathclose]$ \textbf{rechtsgekrümmt} (oder \textbf{konkav}) } \\
\hline
\begin{tikzpicture}[baseline=(current bounding box.center)]
\begin{axis}[
scale=0.5,
my style,
grid=both,
minor x tick num=1,
xmin=-0.2, xmax=3.2,
minor y tick num=1,
ymin = -1.7, ymax = 1.7
]
\addplot[draw=blue,domain=0:3,samples=100]{4/9*(x-1.5)^2-1/2}node[left,blue]{$f$};
\end{axis}
\end{tikzpicture}
&
\makecell[l]{\footnotesize Die Tangentensteigungen \\\footnotesize von $f$ in $\mathopen[a,b\mathclose]$ \\\footnotesize werden grösser.}
&
\begin{tikzpicture}[baseline=(current bounding box.center)]
\begin{axis}[
scale=0.5,
my style,
grid=both,
minor x tick num=1,
xmin=-0.2, xmax=3.2,
minor y tick num=1,
ymin = -1.7, ymax = 1.7
]
\addplot[draw=blue,domain=0:3,samples=100]{-4/9*(x-1.5)^2+1/2}node[left,below,blue]{$g$};
\end{axis}
\end{tikzpicture}
&
\makecell[l]{\footnotesize Die Tangentensteigungen \\\footnotesize von $g$ in $\mathopen[a,b\mathclose]$ \\\footnotesize werden kleiner.}\\
\hline
\end{tabular}
\end{document}