использование рамок в пределах itemize или enumerate

использование рамок в пределах itemize или enumerate

У меня есть следующий код:

\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}

И я продолжаю получать ошибку "Что-то не так — возможно, отсутствует \item"

Как это исправить?

решение1

Вам нужно \leavevmodeперед framedсредой; однако, я хотел бы предложить вам другой подход с использованием tcolorboxпакета (который вы уже загружаете). Ниже сравнительный пример с оригиналом framed, а затем с tcolorboxопределенной шириной (a \makeboxиспользовалось для центрирования поля относительно \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}

Результат:

введите описание изображения здесь

я использовал

\usepackage[margin=2cm,showframe]{geometry}

в примере просто для визуального руководства по макету страницы.

решение2

Другой вариант — использовать minipageсреду, как показано в коде.

\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}

Связанный контент