根据 Christian 几个小时前给我的解决方案,我必须扩展我的问题并使其更加准确。
请参阅 Christian 的帖子中的解决方案,
\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}
解决方案应该是。(1)问题和答案之间没有链接。(2)没有 hyperref 的 framedcrayon 环境(3)仅列出 framedanswer 的 listofcommand。(4)链接仅在项目列表和其所在页面上的项目本身之间。
framedanswer 应该可以单独使用。
原因:我尝试修改该解决方案以使其满足我的需求,但失败了。
如果我想提出一个问题,那将是 framedanswer 标题中的问题,答案本身就在框里面。
希望这些信息足够具体....
答案1
根据与 OP 的私人交流,bclogo
最好使用不带软件包的解决方案。以下使用 重建框。尽管如此,仍可以在不加载该软件包的情况下使用 的tcolorbox
非常漂亮的图形。bclogo
希望能够满足以下要求:
\documentclass[dvipsnames]{article}
\usepackage[skins]{tcolorbox}
\usepackage{lipsum}
\usepackage{hyperref}
\newtcolorbox{framedcrayon}[2][]{%
enhanced,
colback=yellow!15,
colframe=Maroon,
coltitle=black,
fonttitle=\bfseries\large,
boxrule=0.3mm,arc=1mm,boxsep=0pt,left=7mm,
title={#2},
attach title to upper={\par\smallskip},
underlay={
\node[inner sep=0pt] (logo) at ([xshift=4mm,yshift=-4mm]frame.north west) {\includegraphics[width=6mm]{bc-crayon}};
\draw[line width=0.5mm] (logo) -- ([yshift=1mm]logo|-frame.south);
},
#1
}
\newtcolorbox[auto counter,list inside=myfan,list type=section]{framedanswer}[2][]{%
enhanced,
colback=white,
colframe=Maroon,
coltitle=white,
fonttitle=\bfseries,
boxrule=0.3mm,arc=1mm,boxsep=0pt,left=7mm,
title={#2},
attach boxed title to top center={yshift*=-0.15mm-\tcboxedtitleheight/2},
boxed title style={enhanced,interior hidden,size=small},
underlay={
\node[inner sep=0pt] (logo) at ([xshift=4mm,yshift=-4mm]frame.north west) {\includegraphics[width=6mm]{bc-crayon}};
},
#1
}
\makeatletter
\newcommand{\listofframedanswer}{%
\tcblistof[\section*]{myfan}{Answer}
}
\makeatother
\begin{document}
\listofframedanswer
\section{First}
\begin{framedcrayon}{One}
Hello
\end{framedcrayon}
\begin{framedcrayon}{Two}
Hello again
\end{framedcrayon}
\clearpage
\begin{framedanswer}{The title}
\lipsum[4]
\end{framedanswer}
\clearpage
\begin{framedanswer}{Another answer}
\lipsum[4]
\end{framedanswer}
\end{document}