Graphics, Figures & TablesAlignment for Multiple Choice

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Alignment for Multiple Choice

Post by coachbennett1981 »

Good morning,

I am working on an exam and I am trying to have a multiple choice question in which students have to determine which graph represents a function f(x). I have four choices, but can't seem to get he bottom two graphs to "align." Is there an easy way to fix this?


Thank you for your time,


Nicholas

Code: Select all

\documentclass[12pt]{exam}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{multicol}
\usepackage{pstricks-add}

\psset{unit=0.75cm,arrowinset=0,arrowsize=8pt,arrows=<->}

\begin{document}
  \begin{multicols}{2}
  \begin{choices}
    \choice \begin{pspicture}(0,-3)(5,3)
      \psaxes(0,0)(-4,-4)(5,4)[$x$,-90][$y$,180]
      \psplot[algebraic,linecolor=red,linewidth=1.5pt,arrows=<->]{-2}{1.5}{2^x}
    \end{pspicture}

  \choice  \begin{pspicture}(0,-3)(5,3)
      \psaxes(0,0)(-4,-4)(5,4)[$x$,-90][$y$,180]
      \psplot[algebraic,linecolor=blue,linewidth=1.5pt,arrows=<->]{-2}{2}{x^2}
    \end{pspicture}
    
      \choice \begin{pspicture}(0,-6)(5,3)
      \psaxes(0,0)(-4,-4)(5,4)[$x$,-90][$y$,180]
      \psplot[algebraic,linecolor=blue,linewidth=1.5pt,arrows=<->]{-1}{1}{x^2}
    \end{pspicture}

  \choice  \begin{pspicture}(0,-8)(5,3)
      \psaxes(0,0)(-4,-4)(5,4)[$x$,-90][$y$,180]
      \psplot[plotstyle=curve,linecolor=blue,linewidth=1.5pt,arrows=<->]{-1.5}{3.5}{x x mul -2 x mul add}
    \end{pspicture}
  \end{choices}
  
  \end{multicols}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Alignment for Multiple Choice

Post by coachbennett1981 »

I did it by messing with the code, but I just guessed. Can anyone explain how the the pspicture{x1,x2}{x2,y2} works? I understand the concept of how and where it creates the picture environment but 3 of the four pictures have the same x1,y1, but different lower left corner output x2,y2.

Code: Select all

\documentclass[12pt]{exam}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{multicol}
\usepackage{pstricks-add}

\psset{unit=0.75cm,arrowinset=0,arrowsize=8pt,arrows=<->}

\begin{document}
 
  \begin{pspicture}(0,-3)(5,3)
      \psaxes(0,0)(-4,-4)(5,4)[$x$,-90][$y$,180]
      \psplot[algebraic,linecolor=red,linewidth=1.5pt,arrows=<->]{-2}{1.5}{2^x}
    \end{pspicture}
    \begin{pspicture}(0,-3)(-10,3)
      \psaxes(0,0)(-4,-4)(5,4)[$x$,-90][$y$,180]
      \psplot[algebraic,linecolor=blue,linewidth=1.5pt,arrows=<->]{-2}{2}{x^2}
    \end{pspicture}
  
  \noindent
   \begin{pspicture}(-1,-3)(5,8)
      \psaxes(0,0)(-4,-4)(5,4)[$x$,-90][$y$,180]
      \psplot[algebraic,linecolor=blue,linewidth=1.5pt,arrows=<->]{-1}{1}{x^2}
    \end{pspicture}
   \begin{pspicture}(0,-3)(-10,8)
      \psaxes(0,0)(-4,-4)(5,4)[$x$,-90][$y$,180]
      \psplot[plotstyle=curve,linecolor=blue,linewidth=1.5pt,arrows=<->]{-1.5}{3.5}{x x mul -2 x mul add}
    \end{pspicture}
Post Reply