Pgfplots:需要强制左侧两个坐标平面以避免右侧出血

Pgfplots:需要强制左侧两个坐标平面以避免右侧出血

在这张工作表中,我选择增加坐标平面的大小,以便学生能够更轻松地绘制方程式。

\pgfplotsset{width=10cm,compat=1.18}

结果导致右侧列的坐标平面超出页面。

在此处输入图片描述

除了减少之外\plotset{width=,是否可以用一行代码强制 L 和 R 列中的平面向左移动,以利用 L 边距中的空白空间?

非常感谢您花时间帮助我!

姆韦

\documentclass[12pt]{exam}
\usepackage[a4paper,margin=0.5in,include head]{geometry}
\usepackage{amsmath}
\usepackage{systeme}
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.18}

\usetikzlibrary{intersections}
\usepackage{tikz}
\usepackage{enumitem,tasks}
\settasks{
%  after-item-skip=5em,
%  after-skip=2cm,
  label-width=2em,
  item-indent=3em,
  label=(\arabic*),
  column-sep=2em,
 }
 \pagestyle{head}
\header{\textbf{Algebra II: Quadratic Systems}}
{}
{ 04/17/23} 
\begin{document}

\textbf {SET A: Solve each system by graphing.}

\begin{tasks}(2)
%Prob #1
\task* $\syslineskipcoeff{1}\systeme*{y=2(x+4)^2-5, y=-2x-9}$\\
\bigskip
\begin{tikzpicture}
        \begin{axis}[
            axis lines=middle,
            axis line style={-stealth,shorten >=-3mm},
            xlabel=$x$, xlabel style={anchor=south west},
            ylabel=$y$, ylabel style={anchor=south east},
            grid=both,
            grid style={draw=gray!25},
            ticklabel style={font=\scriptsize, text=black!50, inner sep=1pt},
            xmin=-10,   xmax=10,          
            ymin=-10,   ymax=10,
            xtick distance=2,
            ytick distance=2,
            minor tick num=1,
            tick align=outside,
        ]
        \end{axis}
    \end{tikzpicture}
%Prob #2
  \task* $\syslineskipcoeff{1}\systeme*{y=2(x+4)^2-3, y=x+7}$\\
\bigskip
\begin{tikzpicture}
        \begin{axis}[
            axis lines=middle,
            axis line style={-stealth,shorten >=-3mm},
            xlabel=$x$, xlabel style={anchor=south west},
            ylabel=$y$, ylabel style={anchor=south east},
            grid=both,
            grid style={draw=gray!25},
            ticklabel style={font=\scriptsize, text=black!50, inner sep=1pt},
            xmin=-10,   xmax=10,          
            ymin=-10,   ymax=10,
            xtick distance=2,
            ytick distance=2,
            minor tick num=1,
            tick align=outside,
        ]
        \end{axis}
    \end{tikzpicture}
%Prob #3
\task* $\syslineskipcoeff{1}\systeme*
{y=2(x-3)^2+1, 2x+y=11}$\\
\begin{tikzpicture}
        \begin{axis}[
            axis lines=middle,
            axis line style={-stealth,shorten >=-3mm},
            xlabel=$x$, xlabel style={anchor=south west},
            ylabel=$y$, ylabel style={anchor=south east},
            grid=both,
            grid style={draw=gray!25},
            ticklabel style={font=\scriptsize, text=black!50, inner sep=1pt},
            xmin=-10,   xmax=10,          
            ymin=-10,   ymax=10,
            xtick distance=2,
            ytick distance=2,
            minor tick num=1,
            tick align=outside,
        ]
        \end{axis}
    \end{tikzpicture}        
%Prob #4
\task* $\syslineskipcoeff{1}\systeme*
{y=\frac{1}{2}(x-4)^2-3, y=2x-11}$\\
\bigskip
\begin{tikzpicture}
        \begin{axis}[
            axis lines=middle,
            axis line style={-stealth,shorten >=-3mm},
            xlabel=$x$, xlabel style={anchor=south west},
            ylabel=$y$, ylabel style={anchor=south east},
            grid=both,
            grid style={draw=gray!25},
            ticklabel style={font=\scriptsize, text=black!50, inner sep=1pt},
            xmin=-10,   xmax=10,          
            ymin=-10,   ymax=10,
            xtick distance=2,
            ytick distance=2,
            minor tick num=1,
            tick align=outside,
        ]
        \end{axis}
    \end{tikzpicture}
    
\end{tasks}

\end{document}

答案1

  • 您的图像太宽,无法放在一行中。

编辑:
我猜你喜欢保留图像宽度并将它们移动到列的左边框task

  • 为了几乎保留它们的宽度,您需要利用列宽,即图像应该从左列边框开始task
  • 这可以通过使用changepage包和\@parboxrestore命令来完成。
  • 除上述内容外,您仍然需要减少column-sep到 0.75\em:

在此处输入图片描述

\documentclass[12pt]{exam}
\usepackage[a4paper,margin=0.5in,include head]{geometry}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{amsmath}
\usepackage{systeme}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}       % <---
\pgfplotsset{GRID/.style = {    % define common style for images
    width=100mm,
    axis lines=middle,
    axis line style={-stealth,shorten >=-3mm},
    xlabel=$x$, xlabel style={anchor=south west},
    ylabel=$y$, ylabel style={anchor=south east},
    grid=both,
    grid style={draw=gray!25},
    ticklabel style={font=\scriptsize, text=black!50, inner sep=1pt},
    xmin=-10,   xmax=10,
    ymin=-10,   ymax=10,
    xtick distance=2,
    ytick distance=2,
    minor tick num=1,
    tick align=outside,
            }}
\usetikzlibrary{intersections}

%---------------------------------------------------------- added
\usepackage[strict]{changepage}     
\makeatletter
\newsavebox\restorebox              
\newenvironment{restoretext}%
    {\@parboxrestore%
     \begin{adjustwidth}{-3em}{}%
                \begin{lrbox}{\restorebox}%
                \begin{minipage}{\linewidth}%
    }{\end{minipage}\end{lrbox}
        \usebox\restorebox
        \end{adjustwidth}
     }
\makeatother     
%---------------------------------------------------------------%
\usepackage{tikz}
\usepackage{enumitem,tasks}
\settasks{
  label-width=2em,
  item-indent=3em,
  label=(\arabic*),
  column-sep=0.75em,    % <---
 }
 \pagestyle{head}
\header{\textbf{Algebra II: Quadratic Systems}}
{}
{ 04/17/23}
\begin{document}

\textbf {SET A: Solve each system by graphing.}

\begin{tasks}(2)   
%Prob #1
\task $\syslineskipcoeff{1}\systeme*{y=2(x+4)^2-5, y=-2x-9}$\\
\medskip
\begin{restoretext}
\begin{tikzpicture}
        \begin{axis}[GRID]
        \end{axis}
    \end{tikzpicture}
\end{restoretext}

%Prob #2
  \task $\syslineskipcoeff{1}\systeme*{y=2(x+4)^2-3, y=x+7}$\\
\medskip
\begin{restoretext}
\begin{tikzpicture}
        \begin{axis}[GRID]
        \end{axis}
    \end{tikzpicture}
\end{restoretext}

\bigskip
%Prob #3
\task $\syslineskipcoeff{1}\systeme*
{y=2(x-3)^2+1, 2x+y=11}$\\
\medskip
\begin{restoretext}
\begin{tikzpicture}
        \begin{axis}[GRID]
        \end{axis}
    \end{tikzpicture}
\end{restoretext}
%Prob #4
\task $\syslineskipcoeff{1}\systeme*
{y=\frac{1}{2}(x-4)^2-3, y=2x-11}$\\
\medskip
\begin{restoretext}
\begin{tikzpicture}
        \begin{axis}[GRID]
        \end{axis}
    \end{tikzpicture}
\end{restoretext}
\end{tasks}

\end{document}

答案2

此解决方案\makebox[\columnwidth]{...}通过重叠两侧来将内容塞入任务中。

使用 可以更好地均衡边距\makebox[\dimexpr \columnwidth-\labelwidth-\labelsep]{...}

\documentclass[12pt]{article}
\usepackage[a4paper,margin=0.5in,include head,headheight=17pt]{geometry}
\usepackage{amsmath}
\usepackage{systeme}
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.18}

\usetikzlibrary{intersections}
\usepackage{tikz}
\usepackage{enumitem,tasks}
\settasks{
%  after-item-skip=5em,
%  after-skip=2cm,
  label-width=2em,
  item-indent=3em,
  label=(\arabic*),
  column-sep=2em,
 }
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[L]{\textbf{Algebra II: Quadratic Systems}}
\fancyhead[R]{04/17/23}
\pagestyle{fancy}

\begin{document}

\textbf {SET A: Solve each system by graphing.}

\begin{tasks}(2)
%Prob #1
\task $\syslineskipcoeff{1}\systeme*{y=2(x+4)^2-5, y=-2x-9}$\\
\bigskip
\makebox[\columnwidth]{\begin{tikzpicture}
        \begin{axis}[
            axis lines=middle,
            axis line style={-stealth,shorten >=-3mm},
            xlabel=$x$, xlabel style={anchor=south west},
            ylabel=$y$, ylabel style={anchor=south east},
            grid=both,
            grid style={draw=gray!25},
            ticklabel style={font=\scriptsize, text=black!50, inner sep=1pt},
            xmin=-10,   xmax=10,          
            ymin=-10,   ymax=10,
            xtick distance=2,
            ytick distance=2,
            minor tick num=1,
            tick align=outside,
        ]
        \end{axis}
        \draw[red] (current bounding box.south west) rectangle (current bounding box.north east);
    \end{tikzpicture}}
%Prob #2
  \task $\syslineskipcoeff{1}\systeme*{y=2(x+4)^2-3, y=x+7}$\\
\bigskip
\makebox[\columnwidth]{\begin{tikzpicture}
        \begin{axis}[
            axis lines=middle,
            axis line style={-stealth,shorten >=-3mm},
            xlabel=$x$, xlabel style={anchor=south west},
            ylabel=$y$, ylabel style={anchor=south east},
            grid=both,
            grid style={draw=gray!25},
            ticklabel style={font=\scriptsize, text=black!50, inner sep=1pt},
            xmin=-10,   xmax=10,          
            ymin=-10,   ymax=10,
            xtick distance=2,
            ytick distance=2,
            minor tick num=1,
            tick align=outside,
        ]
        \end{axis}
        \draw[red] (current bounding box.south west) rectangle (current bounding box.north east);
    \end{tikzpicture}}
% show task margins
\task \rule{\columnwidth}{\ht\strutbox}

\task \rule{\columnwidth}{\ht\strutbox}
\end{tasks}

\end{document}

相关内容