根据这个问题如何制作这样的模板乳胶?
我将这段出色的代码用于我的文档系统。
目标是有一个框架答案的列表(问题列表并告知,该问题在列表中的哪个页面,在最好的情况下,我可以单击该问题,否则在页面上跳转到问题所在的位置。
\documentclass[dvipsnames]{article}
\usepackage[tikz]{bclogo}
\usepackage{lipsum}
\newenvironment{framedcrayon}[2][]
{\begin{bclogo}[
logo=\bccrayon,
couleur=yellow!15,
arrondi=0.1,
couleurBord=Maroon,#1]{#2}
}
{\end{bclogo}}
% \newtheorem{xfeature}{feature}
% \newcommand\listxfeaturesname{Liste of Features}
% \newlistof{feature}{xfeature}{\listxfeaturesname}
% \newcommand\qdescription[1]{%
% \addcontentsline{xfeature}{feature}%
% {\protect\makebox[2.5cm][l]{Feature~\thexfeature\hfill}#1}}
% \newenvironment{mfeature}[1][]{\begin{xfeature}\qdescription{#1}}{\end{xfeature}}
% \providecommand{\feature}[1]{%
% \begin{mfeature}[#1]
% #1
% \end{mfeature}
% }
% \newtheorem{xfanswer}{Fragen}
% \newcommand\listxanswername{\protect\langanswers}
% \newlistof{Fragen}{xfanswer}{\listxanswername}
% \newcommand\qadescription[1]{%
% \addcontentsline{xfanswer}{Fragen}%
% {\protect\makebox[2.5cm][l]{Fragen~\thexfanswer\hfill}#1}}
\newenvironment{framedanswer}[2][]
{\renewcommand\bcStyleTitre[1]{
\hfill\tikz[overlay]\node[fill=Maroon,align=center,text=white,rounded corners=2pt,yshift=15pt] {\strut##1};\hfill}
\renewcommand\logowidth{0pt}
\begin{bclogo}[
logo=\bccrayon,
arrondi=0.1,
epBarre=0,
couleurBord=Maroon,#1]{#2}
}
{\end{bclogo}}
\begin{document}
\begin{framedanswer}{The title}
\lipsum[4]
\end{framedanswer}
% \listofframedanswer %<---
\end{document}
这里有一些我试验过的代码......
答案1
这允许从问题到答案的正向和反向链接,但要求答案的顺序与问题的顺序相匹配。
\documentclass[dvipsnames]{article}
\usepackage[tikz]{bclogo}
\usepackage{lipsum}
\newcounter{framedquestion}
\usepackage{hyperref}
\newenvironment{framedcrayon}[2][]{%
\phantomsection
\refstepcounter{framedquestion}
\begin{bclogo}[
logo=\bccrayon,
couleur=yellow!15,
arrondi=0.1,
couleurBord=Maroon,#1]{\protect\hypertarget{question::\number\value{framedquestion}}{#2} -- \protect\hyperlink{answer::\number\value{framedquestion}}{Answer}}
\protect\addcontentsline{fac}{section}{\protect\numberline{\theframedquestion}#2}%
}{%
\end{bclogo}
}
\newenvironment{framedanswer}[2][]{%
\refstepcounter{framedquestion}
\renewcommand\bcStyleTitre[1]{%
\hfill\tikz[overlay]\node[fill=Maroon,align=center,text=white,rounded corners=2pt,yshift=15pt] {\strut##1};\hfill}
% \renewcommand\logowidth{0pt}% Faulty???
\begin{bclogo}[
logo=\bccrayon,
arrondi=0.1,
epBarre=0,
couleurBord=Maroon,#1]{\protect\hypertarget{answer::\number\value{framedquestion}}{#2} -- \protect\hyperlink{question::\number\value{framedquestion}}{Question}
\protect\addcontentsline{fan}{section}{\protect\numberline{\theframedquestion}#2}%
%
}
}{%
\end{bclogo}
}
\makeatletter
\newcommand{\listofframedcrayons}{%
\section*{Questions}
\@starttoc{fac}
}
\newcommand{\listofframedanswer}{%
\section*{Answers}
\@starttoc{fan}
}
\makeatother
\begin{document}
\listofframedcrayons %<---
\listofframedanswer %<---
\section{First}
\begin{framedcrayon}{One}
Hello
\end{framedcrayon}
\begin{framedcrayon}{Two}
Hello again
\end{framedcrayon}
\setcounter{framedquestion}{0}
\clearpage
\begin{framedanswer}{The title}
\lipsum[4]
\end{framedanswer}
\clearpage
\begin{framedanswer}{Another answer}
\lipsum[4]
\end{framedanswer}
\end{document}