我仍在排版一本书,其中每个大部分都有大约 10 张图片,我想将它们的标题添加到目录中,而不是单独的图片列表中。为此,我习惯将\addcontentsline
一些标题文本添加为目录中的章节条目。
有些图片必须水平放置,所以我必须将它们与标题一起旋转。当我尝试调整浮点型(v1.1, 2012/03/04) 包满足我的需求后,我发现该命令\addcontentsline
会产生错误的页码,无论它放在何处 - 之前\hvFloat
或之后。添加\clearpage
帮助也没有用。但如果生成了 LoF,则那里的页码是正确的。
我目前正在使用sidewaysfigure
环境,因为到目前为止,所有水平图形都占据了整个页面,所以我可以这样做。但为什么这个命令不能正常工作的问题\hvFloat
仍然存在。是包导致的吗?
此外,当我尝试放置一个垂直图形时,\hvFloat
它也应该填满页面,在浮动之前产生了一个额外的空白页。如果我指定floatPos=h
(或其他任何内容),它将在 ToC 之后的页面上移动。
而且图像本身并不完全适合布局框架,因为它们被移动了 - 包是否会在浮动之前或周围创建额外的空白?如果我选择 - 选项nonFloat
,它会在布局框架外移动几厘米。
这里是 MWE:
\documentclass[fontsize=11pt,russian,open=any]{scrbook}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{fancyhdr}
\usepackage[paperwidth=14.8cm, paperheight=21.0cm, top=1.1cm, bottom=1.8cm, twoside, inner=0.9cm, outer=1.8cm, bindingoffset=0.5cm, footskip=1cm, headsep=0cm, headheight=0cm, voffset=0cm, hoffset=0cm, marginparsep=0cm, marginparwidth=0cm]{geometry}
\usepackage{graphicx}
\usepackage{microtype}
\usepackage{tocloft}
\usepackage{caption}
\usepackage{floatpag}
\usepackage{showframe}
\usepackage{hvfloat}
\usepackage{lipsum}
\usepackage{rotating}
\renewcommand{\baselinestretch}{0.95}
\setlength{\intextsep}{0pt}
\setlength{\belowcaptionskip}{0pt}
\setlength{\abovecaptionskip}{0mm}
\captionsetup[figure]{labelformat=empty}
\floatpagestyle{empty}
\graphicspath{{Pictures/}}
\DeclareGraphicsExtensions{.pdf,.tiff,.tif,.png,.jpg}
\renewcommand{\footnoterule}{%
\kern -1pt
\hrule width 4.5cm height 0.5pt
\kern 4pt
}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[EC,OC]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\fancypagestyle{plain}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
\renewcommand{\cftsecdotsep}{2}
\cftsetindents{section}{5mm}{4mm}
\setlength{\cftparskip}{0.2\baselineskip}
\cftsetpnumwidth{10mm}
\cftsetrmarg{1.5cm}
\begin{document}
\lipsum
\clearpage
\newgeometry{top=0.75cm, bottom=0.75cm, twoside, inner=0.7cm, outer=1cm, bindingoffset=0.5cm, footskip=0cm, headsep=0cm, headheight=0cm, voffset=0cm, hoffset=0cm, marginparsep=0cm, marginparwidth=0cm}
\begin{sidewaysfigure}
\centering
\captionsetup{width=14cm}
\includegraphics[width=1\textheight]{Newsize90.pdf}
\caption[]{\emph{...Picture via "sidewaysfigure", captionskip=0 on both sides, size is ok...\\if second line appears, picture with capture will shift to the left, outside the frame}}
\addcontentsline{toc}{section}{\emph{...Picture inserted and rotated via sidewaysfigure environment, size is ok. Page number in ToC is CORRECT...}}
\end{sidewaysfigure}
\clearpage
\restoregeometry
\lipsum
\clearpage
\newgeometry{top=0.75cm, bottom=0.75cm, twoside, inner=0.7cm, outer=1cm, bindingoffset=0.5cm, footskip=0cm, headsep=0cm, headheight=0cm, voffset=0cm, hoffset=0cm, marginparsep=0cm, marginparwidth=0cm}
\addcontentsline{toc}{section}{\emph{...Picture rotated via hvFloat, size is ok, but shifted down by 1mm, page number in ToC is WRONG...}}
\hvFloat[floatPos=p, capWidth=1.1, capPos=b, rotAngle=90, objectPos=l]{figure}{
\includegraphics[width=1\textheight]{Newsize90.pdf}}[rotated - LoF page number is CORRECT]{\emph{...Picture rotated via hvFloat, size is ok, but shifted down by 1mm \\if second line appears, only caption moves to the right, outside the frame...}}{}
\clearpage
\restoregeometry
\lipsum
\clearpage
\newgeometry{top=0.75cm, bottom=0.75cm, twoside, inner=0.7cm, outer=1cm, bindingoffset=0.5cm, footskip=0cm, headsep=0cm, headheight=0cm, voffset=0cm, hoffset=0cm, marginparsep=0cm, marginparwidth=0cm}
\addcontentsline{toc}{section}{\emph{...Picture not rotated, placed via hvFloat, size fits, empty page before float is produced, ToC page number is WRONG...}}
\captionsetup{aboveskip=1mm, width=11.8cm}
\hvFloat{figure}{\includegraphics[width=1\textwidth]{Newsize.pdf}}[not rotated - LoF page number is CORRECT]{\emph{...Picture not rotated, placed via hvFloat, size fits, but fig+cap seem to be placed at the center of page; empty page before float is produced...}}{}
\newpage\null\thispagestyle{empty}\newpage
\tableofcontents
\listoffigures
\end{document}
我使用 TeXstudio 2.6.0 创建的所有文件以及我使用的两张图片都在 这个 zip 文件。
答案1
使用
\hvFloat{figure}{%
\addcontentsline{toc}{section}{blah blah}%%%%%%%%
\includegraphics[width=1\textwidth]{Newsize.pdf}}[not rotated - LoF page number is CORRECT]{\emph{...Picture not rotated, placed via hvFloat, size fits, but fig+cap seem to be placed at the center of page; empty page before float is produced...}}{}
答案2
“我们都漂浮在这里!”-斯蒂芬·金,《它》[Eso]
甚至它这么说是不对的。在 LaTeX 中,浮动会从一个页面飞到另一个页面。如果您希望它\addcontentsline
不会留在地面上,请将其塞入浮动中。
我尝试将\addcontentsline
内容移动到我们示例的标题中,似乎有效了。