我正在尝试将现有文件改编为投影仪演示文稿。它们都有一个预定义的question
环境,我需要更改它。
在testcontent.tex
,我有
\section*{first section}
%%Q1
\begin{question}
The line $y=a^2 x$ and the curve $y=x(b-x)^2$, where $0<a<b\,$, intersect at the origin $O$ and at points $P$ and $Q $. The $x$-coordinate of $P$ is less than the $x$-coordinate of $Q$. Find the coordinates of $P$ and $Q$, and sketch the line and the curve on the same axes.
\end{question}
%%Q2
\begin{question}
If $x=\log_b(c)\,$, express $c$ in terms of $b$ and $x$ and prove that $ \dfrac{\log_a (c)}{\log_a (b)} = \ds \log_b (c) \,$.
\end{question}
\section*{last section}
%%Q3
\begin{question}
The line $y=a^2 x$ and the curve $y=x(b-x)^2$, where $0<a<b\,$, intersect at the origin $O$ and at points $P$ and $Q $. The $x$-coordinate of $P$ is less than the $x$-coordinate of $Q$. Find the coordinates of $P$ and $Q$, and sketch the line and the curve on the same axes.
\end{question}
%%Q4
\begin{question}
If $x=\log_b(c)\,$, express $c$ in terms of $b$ and $x$ and prove that $ \dfrac{\log_a (c)}{\log_a (b)} = \ds \log_b (c) \,$.
\end{question}
我想做的是提出问题每一帧(回答长问题时允许休息),所以我就这么做了
\documentclass[12pt]{beamer}
\usepackage{amsmath,amssymb}
\newcounter{qnumber}
\setcounter{qnumber}{0}
\newenvironment{question}%
{
\begin{frame}[allowframebreaks]%
\begin{enumerate}[\bfseries Q1\quad][10]%
\setcounter{enumi}{\value{qnumber}}%
\item%
}{
\end{enumerate}
\stepcounter{qnumber}
\end{frame}
}
\begin{document}
\input{testcontent}
\end{document}
答案1
改编:
fragile, environment=question
为frame
环境添加了选项- 已删除
[\bfseries Q1\quad][10]
,因为默认枚举没有选项- 改用
\setbeamertemplate{enumerate item}{Q\arabic{enumi}}
- 改用
- 删除了未定义的命令
\ds
代码:
\documentclass[12pt]{beamer}
\usepackage{amsmath,amssymb}
\newcounter{qnumber}
\setcounter{qnumber}{0}
\newenvironment{question}%
{
\begin{frame}[fragile,environment=question,allowframebreaks]
\setbeamertemplate{enumerate item}{Q\arabic{enumi}}
\begin{enumerate}
\setcounter{enumi}{\value{qnumber}}%
\item%
}{
\end{enumerate}
\stepcounter{qnumber}
\end{frame}
}
\begin{document}
\section*{first section}
%%Q1
\begin{question}
The line $y=a^2 x$ and the curve $y=x(b-x)^2$, where $0<a<b\,$, intersect at the origin $O$ and at points $P$ and $Q $. The $x$-coordinate of $P$ is less than the $x$-coordinate of $Q$. Find the coordinates of $P$ and $Q$, and sketch the line and the curve on the same axes.
\end{question}
%%Q2
\begin{question}
If $x=\log_b(c)\,$, express $c$ in terms of $b$ and $x$ and prove that $ \dfrac{\log_a (c)}{\log_a (b)} = \log_b (c) \,$.
\end{question}
\section*{last section}
%%Q3
\begin{question}
The line $y=a^2 x$ and the curve $y=x(b-x)^2$, where $0<a<b\,$, intersect at the origin $O$ and at points $P$ and $Q $. The $x$-coordinate of $P$ is less than the $x$-coordinate of $Q$. Find the coordinates of $P$ and $Q$, and sketch the line and the curve on the same axes.
\end{question}
%%Q4
\begin{question}
If $x=\log_b(c)\,$, express $c$ in terms of $b$ and $x$ and prove that $ \dfrac{\log_a (c)}{\log_a (b)} = \log_b (c) \,$.
\end{question}
\end{document}
结果: