我查找了一个模板,以便将我的作业以漂亮的格式显示出来,但我无法让它看起来像我想要的那样。更具体地说,我想要:
- 将后面的内容对齐到中间:
\hspace{1in}
...(我尝试使用hspace
,但语句没有对齐,它们只是与最后一个字符具有相同的空间。 - 我尝试过使用内联显示以外的其他方法
$$
,但结果公式却居中对齐,我不喜欢这样。我希望它们左对齐 - 如果可能的话我想将页面分成两列
以下是 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
感谢您提供 MWE (最大工作示例) :-)
。您可以使用tabular
第一行方程的环境并将它们全部对齐,如以下代码所示:
\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}
附注:与其使用\\
在项目之间添加额外空间(这会导致糟糕的盒子),不如使用enumitem
包并设置itemsep
,就像我所做的那样。此外,与其手动输入数字,不如使用start =
的功能enumitem
。这将是该问题的 MWE(最小工作示例)。
\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}