我正在尝试定义一个自\newenvironment
定义的引文。如果没有,environment
它会按如下方式运行:
\documentclass[12pt,a4paper]{article}
\usepackage{lipsum}
\usepackage{Archivo}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{sectsty}
\usepackage{xcolor}
\usepackage{tcolorbox}
%%%%pullquote%%%%
\definecolor{colorquote}{HTML}{e8e9f5}
\newtcolorbox{myquote{colback=colorquote,colframe=colorquote,arc=0pt,outer arc=0pt}
\DeclareUnicodeCharacter{202F}{\,}
\usepackage[colorlinks,hidelinks,urlcolor=blue,bookmarks=false,hypertxnames=true]{hyperref}
\usepackage[notes,autocite=footnote,backend=biber,natbib=true,sorting=nyt,]{biblatex-chicago}
\ExecuteBibliographyOptions{maxcitenames=1}
\DeclareFieldFormat{citehyperref}{%
\DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
\bibhyperref{#1}}
\savebibmacro{cite}
\renewbibmacro*{cite}{%
\printtext[citehyperref]{%
\restorebibmacro{cite}%
\usebibmacro{cite}}}
\addbibresource{}
\author{}
\title{\color[RGB]{40,39,129,255}\textbf{Title}}
\begin{document}
\maketitle
\lipsum[1]
\begin{wrapfigure}{r}{0.35\textwidth}
\begin{myquote}
content for pull quote
\end{myquote}
\end{wrapfigure}
\lipsum*[3]
\end{document}
但是当我尝试创建它时,\newenvironment
它给出了:
\documentclass[12pt,a4paper]{article}
\usepackage{lipsum}
\usepackage{Archivo}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{sectsty}
\usepackage{xcolor}
\usepackage{tcolorbox}
%%%%%section fonts%%%%
\sectionfont{\color[HTML]{282781}}
\subsectionfont{\color[HTML]{282781}}
%%%%pullquote%%%%
\definecolor{colorquote}{HTML}{e8e9f5}
\newtcolorbox{myquote}{colback=colorquote, colframe=colorquote,arc=0pt,outer arc=0pt}
\newenvironment{pullquote}
{\begin{wrapfigure}{r}{0.35\textwidth}
\begin{myquote}
\end{myquote}
\end{wrapfigure}
}
\DeclareUnicodeCharacter{202F}{\,}
\usepackage[colorlinks,hidelinks,urlcolor=blue,bookmarks=false,hypertexnames=true]{hyperref}
\usepackage[notes,autocite=footnote,backend=biber,natbib=true,sorting=nyt,]{biblatex-chicago}
\ExecuteBibliographyOptions{maxcitenames=1}
\DeclareFieldFormat{citehyperref}{%
\DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
\bibhyperref{#1}}
\savebibmacro{cite}
\renewbibmacro*{cite}{%
\printtext[citehyperref]{%
\restorebibmacro{cite}%
\usebibmacro{cite}}}
\addbibresource{}
\author{Louis Vigneras}
\title{\color[RGB]{40,39,129,255}\textbf{Title}}
\begin{document}
\maketitle
\lipsum[1]
\begin{pullquote}
content for pull quote.
\end{pullquote}
\lipsum*[3]
\end{document}
PS 我保留了其他包,以防出现包冲突的问题。
答案1
\newenvironment{pullquote}
{\begin{wrapfigure}{r}{0.35\textwidth}
\begin{myquote}
\end{myquote}
\end{wrapfigure}
}
是
\newenvironment{pullquote}
{\begin{wrapfigure}{r}{0.35\textwidth}
\begin{myquote}
\end{myquote}
\end{wrapfigure}
}
{\par}
所以
\begin{pullquote}
content for pull quote.
\end{pullquote}
是
\begingroup
\begin{wrapfigure}{r}{0.35\textwidth}
\begin{myquote}
\end{myquote}
\end{wrapfigure}
content for pull quote.
\par
\endgroup
与wrapfigure
空的。
你打算
\newenvironment{pullquote}
{\begin{wrapfigure}{r}{0.35\textwidth}
\begin{myquote}%
}
{%
\end{myquote}
\end{wrapfigure}%
}
因此环境的内容进入了 wrapfig 内部。但wrapfig
需要调整以下段落的形状,因此不能位于诸如环境之类的组中,因此更容易使用命令
\documentclass[12pt,a4paper]{article}
\usepackage{lipsum}
\usepackage{Archivo}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{sectsty}
\usepackage{xcolor}
\usepackage{tcolorbox}
%%%%%section fonts%%%%
\sectionfont{\color[HTML]{282781}}
\subsectionfont{\color[HTML]{282781}}
%%%%pullquote%%%%
\definecolor{colorquote}{HTML}{e8e9f5}
\newtcolorbox{myquote}{colback=colorquote, colframe=colorquote,arc=0pt,outer arc=0pt}
\newcommand\pullquote[1]{%
\begin{wrapfigure}{r}{0.35\textwidth}%
\begin{myquote}%
#1%
\end{myquote}%
\end{wrapfigure}}
\DeclareUnicodeCharacter{202F}{\,}
\usepackage[colorlinks,hidelinks,urlcolor=blue,bookmarks=false,hypertexnames=true]{hyperref}
\usepackage[notes,autocite=footnote,backend=biber,natbib=true,sorting=nyt,]{biblatex-chicago}
\ExecuteBibliographyOptions{maxcitenames=1}
\DeclareFieldFormat{citehyperref}{%
\DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
\bibhyperref{#1}}
\savebibmacro{cite}
\renewbibmacro*{cite}{%
\printtext[citehyperref]{%
\restorebibmacro{cite}%
\usebibmacro{cite}}}
\addbibresource{}
\author{Louis Vigneras}
\title{\color[RGB]{40,39,129,255}\textbf{Title}}
\begin{document}
\maketitle
\lipsum[1]
\pullquote{content for pull quote.}
\lipsum*[3]
\end{document}