繁體
|
簡體
Sclub交友聊天~加入聊天室當版主
(檢舉)
分享
新浪微博
QQ空间
人人网
腾讯微博
Facebook
Google+
Plurk
Twitter
Line
标题:
简易双向跳转
[打印本页]
作者:
kuing
时间:
2018-2-10 15:34
标题:
简易双向跳转
问题来自:
http://bbs.ctex.org/forum.php?mod=viewthread&tid=154828
要求:点击题目跳到相应答案,反之亦然,且题目数量多。
我目前实现了点击题目及答案的标号来回跳转,代码如下:
\documentclass{ctexart}
\usepackage{enumitem}
\usepackage{hyperref}
\newcounter{xitinum}
\newenvironment{problem}{\stepcounter{xitinum}%
\textbf{习题\chinese{xitinum}}
\begin{enumerate}[label=\timulabel{\arabic*}]}
{\end{enumerate}}
\newenvironment{answer}{%
\textbf{答案\chinese{xitinum}}
\begin{enumerate}[label=\daanlabel{\arabic*}]}
{\end{enumerate}}
\makeatletter
\protected\def\timulabel#1{%
\hyperlink{daan:\thexitinum:#1}{%
\Hy@raisedlink{\hypertarget{timu:\thexitinum:#1}{}}%升高锚点
\arabic{xitinum}-#1.}}
\protected\def\daanlabel#1{%
\hyperlink{timu:\thexitinum:#1}{%
\Hy@raisedlink{\hypertarget{daan:\thexitinum:#1}{}}%
\arabic{xitinum}-#1.}}
\makeatother
\begin{document}
\begin{problem}
\item 题目题目题目
\item 题目题目题目
\item 题目题目题目
\end{problem}
\begin{answer}
\item 答案答案答案
\item 答案答案答案
\item 答案答案答案
\end{answer}
\begin{problem}
\item 题目题目题目
\item 题目题目题目
\item 题目题目题目
\end{problem}
\begin{answer}
\item 答案答案答案
\item 答案答案答案
\item 答案答案答案
\end{answer}
\begin{problem}
\item 题目题目题目
\item 题目题目题目
\item 题目题目题目
\end{problem}
\begin{answer}
\item 答案答案答案
\item 答案答案答案
\item 答案答案答案
\end{answer}
\newpage
其他细节自己调节。
\end{document}
复制代码
(部分代码参考了
http://bbs.ctex.org/forum.php?mod=viewthread&tid=153386
一帖的10楼)
效果我就不截图了,因为截了也没用,需要点击才能知道效果。
但那帖的楼主的要求是更高的,想要点击内容来跳转,我看不太好做,而且如果题目内容较多而且复杂时估计也容易出问题,我看就算了。
作者:
isee
时间:
2018-2-10 23:39
我出卷基本都不配答案,麻烦,配也只配个结果。
不过,还是值得看看。
欢迎光临 悠闲数学娱乐论坛(第2版) (http://kuing.orzweb.net/)
Powered by Discuz! 7.2