发布时间:2012-09-22 23:25:18
文章类别:小技巧
原文地址:http://blog.sina.com.cn/s/blog_5e16f1770102f6ny.html

QQ群:91940767/145316219/141877998/80300084/194770436
淘宝店:http://latexstudio.taobao.com
技巧续篇:http://latexstudio.net/
常见数学公式问题集下载

看图如下:

enter image description here

选自:http://tex.stackexchange.com/questions/52432/how-to-put-the-list-of-figures-into-a-table

代码节选如下:

例子一:
\documentclass{book}

\let\latexcontentsline\contentsline
\usepackage{hyperref}

\makeatletter

\renewcommand\listoffigures{%
\chapter*{\listfigurename}%
\@mkboth{\MakeUppercase\listfigurename}%
{\MakeUppercase\listfigurename}%
\begingroup\let\addvspace\@gobble
\raggedbottom\offinterlineskip\def\l@figure{\xiao@figure}\parindent\z@
\let\contentsline\latexcontentsline
\hrule
\vrule\vrule width \z@ height 1.2\ht\strutbox depth 1.2\dp\strutbox
\makebox[\dimexpr3cm-0.8pt\relax][c]{\bfseries Number}\vrule
\parbox{\dimexpr\textwidth-6cm}{\normalbaselines\centering {\large\strut}\bfseries Caption{\large\strut}}\vrule
\makebox[\dimexpr3cm-0.8pt\relax][c]{\bfseries Page}\vrule
\hrule
\@starttoc{lof}%
\endgroup
}
\def\xiao@figure#1{\xiao@figurei#1}
\long\def\xiao@figurei\numberline#1#2#3#4{%
\vrule\vrule width \z@ height 1.2\ht\strutbox depth 1.2\dp\strutbox
\makebox[\dimexpr3cm-0.8pt\relax][c]{Fig.\ #1}\vrule
\parbox{\dimexpr\textwidth-6cm}{\normalbaselines\centering {\large\strut}#2{\large\strut}}\vrule
\makebox[\dimexpr3cm-0.8pt\relax][c]{#3}\vrule
\hrule
\hskip-.4pt
\hrule
\nobreak
}
\makeatother

例子二:

\documentclass{report}
\usepackage{array,longtable}
\usepackage{xparse}

\ExplSyntaxOn
\tl_new:N \g_listoffigures_storelines_tl
\DeclareDocumentCommand \mynumberline { m m }
{
\tl_set:Nn \l_tmpa_tl {Figure~#1}
\tl_set:Nn \l_tmpb_tl {#2}
}
\DeclareDocumentCommand \mylatfigure { m m }
{
#1
\tl_gput_right:Nx \g_listoffigures_storelines_tl
{
\exp_not:V \l_tmpa_tl \exp_not:N &
\exp_not:V \l_tmpb_tl \exp_not:N &
\exp_not:n { #2 \\ \hline }
}
}
\DeclareDocumentCommand \UseEntries {}
{
\tl_use:N \g_listoffigures_storelines_tl
}
\ExplSyntaxOff

\makeatletter
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{\dimexpr #1 \relax}}
\renewcommand\listoffigures{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\listfigurename}%
\@mkboth{\MakeUppercase\listfigurename}%
{\MakeUppercase\listfigurename}%
\begingroup
\let\l@figure\mylatfigure
\let\numberline\mynumberline
\let\addvspace\@gobble
\@starttoc{lof}%
\begin{longtable}{@{}|C{2.5cm}|C{\linewidth-5cm}|C{2.5cm-6\tabcolsep-4\arrayrulewidth}|@{}}\hline
\textbf{Number} & \textbf{Caption} & \textbf{Page} \\\hline\endhead
\UseEntries
\end{longtable}%
\endgroup
\if@restonecol\twocolumn\fi
}
\makeatother



\begin{document}
\listoffigures

\listoftables
\chapter{foo}
Text
\begin{figure}[!ht]
\caption{caption}
\end{figure}
\begin{table}[!ht]
\caption{caption}
\end{table}
\clearpage
\addtocounter{page}{24}
\chapter{foo}
Text
\begin{figure}[!ht]
\caption{The logo of \TeX}
\end{figure}
\clearpage

\chapter{foo}
Text
\begin{figure}[!ht]
\caption{Some figures of \LaTeX}
\end{figure}
\end{document}

点赞(0)

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部