Ich habe folgenden Code:
\documentclass[a4paper,11pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{classicthesis}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage{amsmath,mathtools}
\usepackage{amsfonts}
\usepackage{color}
\usepackage{url}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{tabu}
\usepackage{amsthm}
\usepackage{fourier-orns}
\usepackage{framed}
\usepackage{tcolorbox}
\usepackage[toc,page]{appendix}
\usepackage[all]{xy}
\begin{document}
\begin{enumerate}
\item For the function $y=x,$ find the derivative, $y'.$
\[y'=\lim_{h\to 0}\frac{(x+h)-x}{h}=\lim_{h\to 0}\frac{h}{h}=\lim_{h\to 0}1=1.\]
\item For the function $y=x^2,$ find the derivative, $y'.$
\begin{align*}
y'=\lim_{h\to 0}\frac{(x+h)^2-x^2}{h}&=\lim_{h\to 0}\frac{x^2+2xh+h^2-x^2}{h}\\
&=\lim_{h\to 0}\frac{2xh+h^2}{h}=\lim_{h\to 0}(2x+h)=2x.
\end{align*}
\begin{center}
\begin{framed}
For the next two examples, we will use the angle sum formula for sine, which is
\[\sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta.\]
\end{framed}
\end{center}
\item For the function $y=\sin x,$ find the derivative, $y'.$
\begin{align*}
y'=\lim_{h\to 0}\frac{\sin (x+h)-\sin x}{h}&=\lim_{h\to 0}\frac{\sin x\cos h+\cos x\sin h-\sin x}{h}\\
&=\lim_{h\to 0}\frac{\sin x(\cos h-1)+\cos x\sin h}{h}\\
&=\left[\lim_{h\to 0}(\sin x)\left(\frac{\cos h-1}{h}\right)\right]\left[\lim_{h\to 0}(\cos x)\left(\frac{\sin h}{h}\right)\right]\\
&=(\sin x)\cdot 0+(\cos x)\cdot 1\\
&=\cos x,
\end{align*}
where we have used $\displaystyle\lim_{h\to 0}\frac{\sin h}{h}=1$ and $\displaystyle\lim_{h\to 0}\frac{\cos h-1}{h}=0$ from section (1.3).
\item Find $\dfrac{d}{dx}\tan x.$
\begin{align*}
\dfrac{d}{dx}\tan x=\displaystyle\lim_{h\to 0}\dfrac{\tan(x+h)-\tan x}{h}&=\displaystyle\lim_{h\to 0}\left(\dfrac{\sin(x+h)}{h\cos(x+h)}-\dfrac{\sin x}{h\cos x}\right)\\
&=\displaystyle\lim_{h\to 0}\left(\dfrac{\sin(x+h)\cos x-\cos(x+h)\sin x}{h\cos(x+h)\cos x}\right)\\
&=\displaystyle\lim_{h\to 0}\left(\dfrac{\sin[(x+h)-x]}{h\cos(x+h)\cos x}\right)\\
&=\displaystyle\lim_{h\to 0}\left[\left(\dfrac{\sin h}{h}\right)\left(\dfrac{1}{\cos(x+h)\cos x}\right)\right]\\
&=\dfrac{1}{\cos^2(x)}=\sec^2 x.
\end{align*}
\end{enumerate}
\end{document}
Und ich erhalte immer wieder die Fehlermeldung "Irgendetwas stimmt nicht - vielleicht fehlt ein \item"
Wie kann ich das beheben?
Antwort1
Sie benötigen \leavevmode
vorher die framed
Umgebung; ich möchte Ihnen jedoch einen anderen Ansatz unter Verwendung des tcolorbox
Pakets (das Sie bereits laden) vorschlagen. Nachfolgend ein Vergleichsbeispiel mit dem Original framed
und dann mit einer tcolorbox
definierten Breite (a \makebox
wurde verwendet, um die Box in Bezug auf zu zentrieren \textwidth
):
\documentclass[a4paper,11pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{classicthesis}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage{amsmath,mathtools}
\usepackage{amsfonts}
\usepackage{color}
\usepackage{url}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{tabu}
\usepackage{amsthm}
\usepackage{fourier-orns}
\usepackage{framed}
\usepackage[many]{tcolorbox}
\usepackage[toc,page]{appendix}
\usepackage[all]{xy}
\usepackage[margin=2cm,showframe]{geometry}
\begin{document}
\begin{enumerate}
\item For the function $y=x,$ find the derivative, $y'.$
\[y'=\lim_{h\to 0}\frac{(x+h)-x}{h}=\lim_{h\to 0}\frac{h}{h}=\lim_{h\to 0}1=1.\]
\item For the function $y=x^2,$ find the derivative, $y'.$
\begin{align*}
y'=\lim_{h\to 0}\frac{(x+h)^2-x^2}{h}&=\lim_{h\to 0}\frac{x^2+2xh+h^2-x^2}{h}\\
&=\lim_{h\to 0}\frac{2xh+h^2}{h}=\lim_{h\to 0}(2x+h)=2x.
\end{align*}
\begin{center}\leavevmode
\begin{framed}
For the next two examples, we will use the angle sum formula for sine, which is
\[\sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta.\]
\end{framed}
\end{center}
\makebox[\linewidth]{%
\begin{tcolorbox}[arc=0pt,outer arc=0pt,colback=white,width=.6\textwidth]
For the next two examples, we will use the angle sum formula for sine, which is
\[\sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta.\]
\end{tcolorbox}}
\item For the function $y=\sin x,$ find the derivative, $y'.$
\begin{align*}
y'=\lim_{h\to 0}\frac{\sin (x+h)-\sin x}{h}&=\lim_{h\to 0}\frac{\sin x\cos h+\cos x\sin h-\sin x}{h}\\
&=\lim_{h\to 0}\frac{\sin x(\cos h-1)+\cos x\sin h}{h}\\
&=\left[\lim_{h\to 0}(\sin x)\left(\frac{\cos h-1}{h}\right)\right]\left[\lim_{h\to 0}(\cos x)\left(\frac{\sin h}{h}\right)\right]\\
&=(\sin x)\cdot 0+(\cos x)\cdot 1\\
&=\cos x,
\end{align*}
where we have used $\displaystyle\lim_{h\to 0}\frac{\sin h}{h}=1$ and $\displaystyle\lim_{h\to 0}\frac{\cos h-1}{h}=0$ from section (1.3).
\item Find $\dfrac{d}{dx}\tan x.$
\begin{align*}
\dfrac{d}{dx}\tan x=\displaystyle\lim_{h\to 0}\dfrac{\tan(x+h)-\tan x}{h}&=\displaystyle\lim_{h\to 0}\left(\dfrac{\sin(x+h)}{h\cos(x+h)}-\dfrac{\sin x}{h\cos x}\right)\\
&=\displaystyle\lim_{h\to 0}\left(\dfrac{\sin(x+h)\cos x-\cos(x+h)\sin x}{h\cos(x+h)\cos x}\right)\\
&=\displaystyle\lim_{h\to 0}\left(\dfrac{\sin[(x+h)-x]}{h\cos(x+h)\cos x}\right)\\
&=\displaystyle\lim_{h\to 0}\left[\left(\dfrac{\sin h}{h}\right)\left(\dfrac{1}{\cos(x+h)\cos x}\right)\right]\\
&=\dfrac{1}{\cos^2(x)}=\sec^2 x.
\end{align*}
\end{enumerate}
\end{document}
Das Ergebnis:
ich benutzte
\usepackage[margin=2cm,showframe]{geometry}
im Beispiel dient es lediglich dazu, eine visuelle Anleitung für das Seitenlayout zu geben.
Antwort2
Eine andere Möglichkeit besteht darin, die Umgebung zu verwenden minipage
, wie im Code gezeigt
\documentclass[a4paper,11pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{classicthesis}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage{amsmath,mathtools}
\usepackage{amsfonts}
\usepackage{color}
\usepackage{url}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{tabu}
\usepackage{amsthm}
\usepackage{fourier-orns}
\usepackage{framed}
\usepackage{tcolorbox}
\usepackage[toc,page]{appendix}
\usepackage[all]{xy}
\begin{document}
\begin{enumerate}
\item For the function $y=x,$ find the derivative, $y'.$
\[y'=\lim_{h\to 0}\frac{(x+h)-x}{h}=\lim_{h\to 0}\frac{h}{h}=\lim_{h\to 0}1=1.\]
\item For the function $y=x^2,$ find the derivative, $y'.$
\begin{align*}
y'=\lim_{h\to 0}\frac{(x+h)^2-x^2}{h}&=\lim_{h\to 0}\frac{x^2+2xh+h^2-x^2}{h}\\
&=\lim_{h\to 0}\frac{2xh+h^2}{h}=\lim_{h\to 0}(2x+h)=2x.
\end{align*}
\begin{minipage}[c]{0.75\textwidth}
\begin{framed}
For the next two examples, we will use the angle sum formula for sine, which is
\[\sin(\alpha+\beta)=\sin\alpha \cos\beta+\cos\alpha \sin\beta.\]
\end{framed}
\end{minipage}
\item For the function $y=\sin x,$ find the derivative, $y'.$
\begin{align*}
y'=\lim_{h\to 0}\frac{\sin (x+h)-\sin x}{h}&=\lim_{h\to 0}\frac{\sin x\cos h+\cos x\sin h-\sin x}{h}\\
&=\lim_{h\to 0}\frac{\sin x(\cos h-1)+\cos x\sin h}{h}\\
&=\left[\lim_{h\to 0}(\sin x)\left(\frac{\cos h-1}{h}\right)\right]\left[\lim_{h\to 0}(\cos x)\left(\frac{\sin h}{h}\right)\right]\\
&=(\sin x)\cdot 0+(\cos x)\cdot 1\\
&=\cos x,
\end{align*}
where we have used $\displaystyle\lim_{h\to 0}\frac{\sin h}{h}=1$ and $\displaystyle\lim_{h\to 0}\frac{\cos h-1}{h}=0$ from section (1.3).
\item Find $\dfrac{d}{dx}\tan x.$
\begin{align*}
\dfrac{d}{dx}\tan x=\displaystyle\lim_{h\to 0}\dfrac{\tan(x+h)-\tan x}{h}&=\displaystyle\lim_{h\to 0}\left(\dfrac{\sin(x+h)}{h\cos(x+h)}-\dfrac{\sin x}{h\cos x}\right)\\
&=\displaystyle\lim_{h\to 0}\left(\dfrac{\sin(x+h)\cos x-\cos(x+h)\sin x}{h\cos(x+h)\cos x}\right)\\
&=\displaystyle\lim_{h\to 0}\left(\dfrac{\sin[(x+h)-x]}{h\cos(x+h)\cos x}\right)\\
&=\displaystyle\lim_{h\to 0}\left[\left(\dfrac{\sin h}{h}\right)\left(\dfrac{1}{\cos(x+h)\cos x}\right)\right]\\
&=\dfrac{1}{\cos^2(x)}=\sec^2 x.
\end{align*}
\end{enumerate}
\end{document}