4

I looked up a template to put my homework in a nice formatting, but I can't get it to look the way I want. More specifically, I want to:

  • Align to the middle whatever is after: \hspace{1in} .... (I tried using hspace, but the statements are not aligned, they just have the same space away from the last character.
  • I have tried using something other than inline display $$, but then I get the equations aligned to the center which I don't like. I want them to be aligned to the left
  • If possible I would like to have the page split into two columns

Here is a MWE:

\documentclass[]{book}

%These tell TeX which packages to use.
\usepackage{array,epsfig}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsxtra}
\usepackage{amsthm}
\usepackage{mathrsfs}
\usepackage{color}

%Here I define some theorem styles and shortcut commands for symbols I use often
\theoremstyle{definition}
\newtheorem{defn}{Definition}
\newtheorem{thm}{Theorem}
\newtheorem{cor}{Corollary}
\newtheorem*{rmk}{Remark}
\newtheorem{lem}{Lemma}
\newtheorem*{joke}{Joke}
\newtheorem{ex}{Example}
\newtheorem*{soln}{Solution}
\newtheorem{prop}{Proposition}

\newcommand{\lra}{\longrightarrow}
\newcommand{\ra}{\rightarrow}
\newcommand{\surj}{\twoheadrightarrow}
\newcommand{\graph}{\mathrm{graph}}
\newcommand{\bb}[1]{\mathbb{#1}}
\newcommand{\Z}{\bb{Z}}
\newcommand{\Q}{\bb{Q}}
\newcommand{\R}{\bb{R}}
\newcommand{\C}{\bb{C}}
\newcommand{\N}{\bb{N}}
\newcommand{\M}{\mathbf{M}}
\newcommand{\m}{\mathbf{m}}
\newcommand{\MM}{\mathscr{M}}
\newcommand{\HH}{\mathscr{H}}
\newcommand{\Om}{\Omega}
\newcommand{\Ho}{\in\HH(\Om)}
\newcommand{\bd}{\partial}
\newcommand{\del}{\partial}
\newcommand{\bardel}{\overline\partial}
\newcommand{\textdf}[1]{\textbf{\textsf{#1}}\index{#1}}
\newcommand{\img}{\mathrm{img}}
\newcommand{\ip}[2]{\left\langle{#1},{#2}\right\rangle}
\newcommand{\inter}[1]{\mathrm{int}{#1}}
\newcommand{\exter}[1]{\mathrm{ext}{#1}}
\newcommand{\cl}[1]{\mathrm{cl}{#1}}
\newcommand{\ds}{\displaystyle}
\newcommand{\vol}{\mathrm{vol}}
\newcommand{\cnt}{\mathrm{ct}}
\newcommand{\osc}{\mathrm{osc}}
\newcommand{\LL}{\mathbf{L}}
\newcommand{\UU}{\mathbf{U}}
\newcommand{\support}{\mathrm{support}}
\newcommand{\AND}{\;\wedge\;}
\newcommand{\OR}{\;\vee\;}
\newcommand{\Oset}{\varnothing}
\newcommand{\st}{\ni}
\newcommand{\wh}{\widehat}
\newcommand{\leftdisplay}[1]{\[\makebox[\textwidth][l]{$\displaystyle #1$}\]}

%Pagination stuff.
\setlength{\topmargin}{-.3 in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textheight}{9.in}
\setlength{\textwidth}{6.5in}
\pagestyle{empty}



\begin{document}


\begin{center}
{\Large Math 3220-1 \hspace{0.5cm} HW 1}\\
\textbf{}\\ %You should put your name here
Date: \today %You should write the date here.
\end{center}

\vspace{0.2 cm}


\subsection*{Exercises for Section 8}

    \begin{enumerate}
        \item[7.]
        $y = f(x)=\frac{1}{2}x^3$ \hspace{1in} $x=2$ and $\Delta{x}= dx = 0.1$\\
        $y' = f'(x)=\frac{3}{2}x^2$\\
        $dy = f'(x)dx = \frac{3}{2} \cdot 2^2 \cdot 0.1 = 0.6$\\
        $\Delta{y} = f(x+\Delta{x}) - f(x)= \left(\frac{1}{2}(2+0.1)^3 - \frac{1}{2}(2)^3 \right) = 0.6305$\\

        \item[8.]
        $y = f(x)=1-2x^2$ \hspace{1in} $x=0$ and $\Delta{x}= dx = -0.1$\\
        $y' = f'(x)=-4x $\\
        $dy = f'(x)dx = -4 \cdot 0 \cdot -0.1 = 0$\\
        $\Delta{y} = f(x+\Delta{x}) - f(x)= \left((1-2(0+-0.1)^2) - (1-2(0)^2)\right) = -0.02$\\

        \item[9.]
        $y = f(x)=x^4-1$ \hspace{1in} $x=-1$ and $\Delta{x} = dx = 0.01$\\
        $y' = f'(x)=4x^3 $\\
        $dy = f'(x)dx = 4(-1)^3 \cdot 0.01 = -0.04$\\
        $\Delta{y} = f(x+\Delta{x}) - f(x)= \left(((-1+0.01)^4 - 1) - ((-1)^4 - 1)\right) = -0.03940399$\\

        \item[10.]
        $y = f(x)=2x+1$ \hspace{1in} $x=2$ and $\Delta{x} = dx = 0.01$\\
        $y' = f'(x)= 2 $\\
        $dy = f'(x)dx = 2 \cdot 0.01 = 0.02$\\
        $\Delta{y} = f(x+\Delta{x}) - f(x)= \left( 2(2+0.01)+1 - 2\cdot2+1 \right) = 0.02$\\
    \end{enumerate}

\end{document}

1 Answer 1

5

Thank you for giving a MWE (Maximum Working Example) :-). You may use the tabular environment for the first line of equation and align all of them as in this code:

\documentclass[]{book}

%These tell TeX which packages to use.
\usepackage{array,epsfig}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsxtra}
\usepackage{amsthm}
\usepackage{mathrsfs}
\usepackage{color}

%Here I define some theorem styles and shortcut commands for symbols I use often
\theoremstyle{definition}
\newtheorem{defn}{Definition}
\newtheorem{thm}{Theorem}
\newtheorem{cor}{Corollary}
\newtheorem*{rmk}{Remark}
\newtheorem{lem}{Lemma}
\newtheorem*{joke}{Joke}
\newtheorem{ex}{Example}
\newtheorem*{soln}{Solution}
\newtheorem{prop}{Proposition}

\newcommand{\lra}{\longrightarrow}
\newcommand{\ra}{\rightarrow}
\newcommand{\surj}{\twoheadrightarrow}
\newcommand{\graph}{\mathrm{graph}}
\newcommand{\bb}[1]{\mathbb{#1}}
\newcommand{\Z}{\bb{Z}}
\newcommand{\Q}{\bb{Q}}
\newcommand{\R}{\bb{R}}
\newcommand{\C}{\bb{C}}
\newcommand{\N}{\bb{N}}
\newcommand{\M}{\mathbf{M}}
\newcommand{\m}{\mathbf{m}}
\newcommand{\MM}{\mathscr{M}}
\newcommand{\HH}{\mathscr{H}}
\newcommand{\Om}{\Omega}
\newcommand{\Ho}{\in\HH(\Om)}
\newcommand{\bd}{\partial}
\newcommand{\del}{\partial}
\newcommand{\bardel}{\overline\partial}
\newcommand{\textdf}[1]{\textbf{\textsf{#1}}\index{#1}}
\newcommand{\img}{\mathrm{img}}
\newcommand{\ip}[2]{\left\langle{#1},{#2}\right\rangle}
\newcommand{\inter}[1]{\mathrm{int}{#1}}
\newcommand{\exter}[1]{\mathrm{ext}{#1}}
\newcommand{\cl}[1]{\mathrm{cl}{#1}}
\newcommand{\ds}{\displaystyle}
\newcommand{\vol}{\mathrm{vol}}
\newcommand{\cnt}{\mathrm{ct}}
\newcommand{\osc}{\mathrm{osc}}
\newcommand{\LL}{\mathbf{L}}
\newcommand{\UU}{\mathbf{U}}
\newcommand{\support}{\mathrm{support}}
\newcommand{\AND}{\;\wedge\;}
\newcommand{\OR}{\;\vee\;}
\newcommand{\Oset}{\varnothing}
\newcommand{\st}{\ni}
\newcommand{\wh}{\widehat}
\newcommand{\leftdisplay}[1]{\[\makebox[\textwidth][l]{$\displaystyle #1$}\]}

%Pagination stuff.
\setlength{\topmargin}{-.3 in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textheight}{9.in}
\setlength{\textwidth}{6.5in}
\pagestyle{empty}

\usepackage{enumitem}

\begin{document}


\begin{center}
{\Large Math 3220-1 \hspace{0.5cm} HW 1}\\
\textbf{}\\ %You should put your name here
Date: \today %You should write the date here.
\end{center}

\vspace{0.2 cm}


\subsection*{Exercises for Section 8}

    \begin{enumerate}[itemsep=2\baselineskip]
        \item[7.]\begin{tabular}[t]{@{}p{.5\linewidth}l}
        $y = f(x)=\frac{1}{2}x^3$ & $x=2$ and $\Delta{x}= dx = 0.1$
        \end{tabular}
        $y' = f'(x)=\frac{3}{2}x^2$\\
        $dy = f'(x)dx = \frac{3}{2} \cdot 2^2 \cdot 0.1 = 0.6$\\
        $\Delta{y} = f(x+\Delta{x}) - f(x)= \left(\frac{1}{2}(2+0.1)^3 - \frac{1}{2}(2)^3 \right) = 0.6305$

        \item[8.]\begin{tabular}[t]{@{}p{.5\linewidth}l}
        $y = f(x)=1-2x^2$ & $x=0$ and $\Delta{x}= dx = -0.1$
        \end{tabular}
        $y' = f'(x)=-4x $\\
        $dy = f'(x)dx = -4 \cdot 0 \cdot -0.1 = 0$\\
        $\Delta{y} = f(x+\Delta{x}) - f(x)= \left((1-2(0+-0.1)^2) - (1-2(0)^2)\right) = -0.02$

        \item[9.]\begin{tabular}[t]{@{}p{.5\linewidth}l}
        $y = f(x)=x^4-1$ & $x=-1$ and $\Delta{x} = dx = 0.01$
        \end{tabular}
        $y' = f'(x)=4x^3 $\\
        $dy = f'(x)dx = 4(-1)^3 \cdot 0.01 = -0.04$\\
        $\Delta{y} = f(x+\Delta{x}) - f(x)= \left(((-1+0.01)^4 - 1) - ((-1)^4 - 1)\right) = -0.03940399$

        \item[10.]\begin{tabular}[t]{@{}p{.5\linewidth}l}
        $y = f(x)=2x+1$ & $x=2$ and $\Delta{x} = dx = 0.01$
        \end{tabular}
        $y' = f'(x)= 2 $\\
        $dy = f'(x)dx = 2 \cdot 0.01 = 0.02$\\
        $\Delta{y} = f(x+\Delta{x}) - f(x)= \left( 2(2+0.01)+1 - 2\cdot2+1 \right) = 0.02$
    \end{enumerate}

\end{document}

enter image description here

As a side note, instead of using \\ to add extra space between items (which gives you bad boxes), you can use enumitem package and set the itemsep as I have done. Also, instead of putting numbers manually, you can use start = facility of enumitem. And this would be the MWE (Minimum Working Example) for the problem.

\documentclass[]{book}
%Pagination stuff.
\setlength{\topmargin}{-.3 in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textheight}{9.in}
\setlength{\textwidth}{6.5in}
\pagestyle{empty}
%
\usepackage{enumitem}
%
\begin{document}
\subsection*{Exercises for Section 8}
    \begin{enumerate}[start = 7,itemsep=2\baselineskip]
        \item {\begin{tabular}[t]{@{}p{.5\linewidth}l}
        $y = f(x)=\frac{1}{2}x^3$ & $x=2$ and $\Delta{x}= dx = 0.1$
        \end{tabular}
        $y' = f'(x)=\frac{3}{2}x^2$\\
        $dy = f'(x)dx = \frac{3}{2} \cdot 2^2 \cdot 0.1 = 0.6$\\
        $\Delta{y} = f(x+\Delta{x}) - f(x)= \left(\frac{1}{2}(2+0.1)^3 - \frac{1}{2}(2)^3 \right) = 0.6305$}

        \item {\begin{tabular}[t]{@{}p{.5\linewidth}l}
        $y = f(x)=1-2x^2$ & $x=0$ and $\Delta{x}= dx = -0.1$
        \end{tabular}
        $y' = f'(x)=-4x $\\
        $dy = f'(x)dx = -4 \cdot 0 \cdot -0.1 = 0$\\
        $\Delta{y} = f(x+\Delta{x}) - f(x)= \left((1-2(0+-0.1)^2) - (1-2(0)^2)\right) = -0.02$}

        \item {\begin{tabular}[t]{@{}p{.5\linewidth}l}
        $y = f(x)=x^4-1$ & $x=-1$ and $\Delta{x} = dx = 0.01$
        \end{tabular}
        $y' = f'(x)=4x^3 $\\
        $dy = f'(x)dx = 4(-1)^3 \cdot 0.01 = -0.04$\\
        $\Delta{y} = f(x+\Delta{x}) - f(x)= \left(((-1+0.01)^4 - 1) - ((-1)^4 - 1)\right) = -0.03940399$}

        \item {\begin{tabular}[t]{@{}p{.5\linewidth}l}
        $y = f(x)=2x+1$ & $x=2$ and $\Delta{x} = dx = 0.01$
        \end{tabular}
        $y' = f'(x)= 2 $\\
        $dy = f'(x)dx = 2 \cdot 0.01 = 0.02$\\
        $\Delta{y} = f(x+\Delta{x}) - f(x)= \left( 2(2+0.01)+1 - 2\cdot2+1 \right) = 0.02$}
    \end{enumerate}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .