在此示例中, \newenvironment 命令的正确语法是什么,才能使 myadjustwidth 像 adjustwidth 一样工作?
\documentclass[10pt,twoside,toc=listofnumbered,headinclude,footinclude,index=numbered]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\usepackage{changepage}
\newenvironment{myadjustwidth}
{\begin{adjustwidth}{3.5mm}{0cm}%
\end{adjustwidth}}
\begin{document}
\blindtext
\begin{adjustwidth}{3.5mm}{0cm}
\blindtext
\end{adjustwidth}
\begin{myadjustwidth}
\blindtext
\end{myadjustwidth}
\end{document}
答案1
您漏掉了右括号和左括号。正确的语法是\newenvironment{<env name>}{<begin>}{<end>}
:
\documentclass[10pt,twoside,toc=listofnumbered,headinclude,footinclude,index=numbered]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\usepackage{changepage}
\newenvironment{myadjustwidth}% <name>
{\begin{adjustwidth}{3.5mm}{0cm}}% <begin> (note the additional closing brace)
{\end{adjustwidth}}% <end> (note the additional opening brace)
\begin{document}
\blindtext
\begin{adjustwidth}{3.5mm}{0cm}
\blindtext
\end{adjustwidth}
\begin{myadjustwidth}
\blindtext
\end{myadjustwidth}
\end{document}