为什么 a4paper 会在图片标题和下面的文字之间添加跳过?

为什么 a4paper 会在图片标题和下面的文字之间添加跳过?

我仍在垂直调整图像和下面的标题。通过这个问题,出现了一个新问题。标题和以下文本之间的跳跃是什么?figureLaTeX 内核中定义的环境在哪里(哪个文件),以便我可以自己调查类似的事情?

正如你在我的例子中看到的,跳过不仅仅是基线跳过,而且我想自己进行设置。

在此处输入图片描述

\documentclass{article}
\usepackage{lipsum,graphicx}
\usepackage[a4paper,left=0mm,right=40mm]{geometry}

\renewcommand{\normalsize}{\fontsize{10bp}{12bp}\selectfont}

\setlength{\textfloatsep}{0bp}
\setlength{\intextsep}{0bp}
\setlength{\abovecaptionskip}{0bp}
\setlength{\belowcaptionskip}{0bp}

\usepackage{tikz}
\usetikzlibrary{calc}

\raggedbottom
\begin{document}


\begin{tikzpicture}[remember picture]
\coordinate(upper) at ($(current page.north east) - (2.5,0)$);
\coordinate(lower) at ($(current page.south east) - (2.5,0)$);
\end{tikzpicture}

This is a
\begin{tikzpicture}[baseline=(x.base)]
\node(x){Test};
\end{tikzpicture}
\lipsum[1-2]
\begin{figure}[h]
    \centering
    \includegraphics[width=170mm,height=63.99mm]{example-image-a}%
    \caption[]{\tikz[baseline=(x.base),remember picture]{\node[inner sep=0pt,outer sep=0pt](x){Just};} a test}%
\end{figure}

\tikz[baseline=(y.base),remember picture]{\node[inner sep=0pt,outer sep=0pt](y){This};} is a line of text to show what happens below the figure.
\begin{tikzpicture}[remember picture, overlay,draw=red]%
\coordinate(x1) at (x.base west);
\coordinate(x2) at (x.base east);
\coordinate(x3) at (intersection of upper--lower and x1--x2);
\draw (x.base west) -- (x3);
\coordinate(y1) at (y.base west);
\coordinate(y2) at (y.base east);
\coordinate(y3) at (intersection of upper--lower and y1--y2);
\draw (y.base west) -- (y3);
\coordinate(nextbaseline1) at ($(y.base west) - (0,12bp)$);
\coordinate(nextbaseline2) at ($(nextbaseline1) + (1,0)$);
\coordinate(nextbaseline3) at (intersection of upper--lower and nextbaseline1--nextbaseline2);
\draw (nextbaseline1) -- (nextbaseline3);
\draw[->] ($(x3) - (0.5cm,0)$) -- ++(0,-12bp)node[midway,right]{more than 12bp};
\draw[->] ($(y3) - (0.5cm,0)$) -- ++(0,-12bp)node[midway,right]{baselineskip=12bp};
\end{tikzpicture}%
\lipsum[1-2]
\end{document}

更新

问题似乎出a4paper在几何选项上。 hack 做了哪些更改,a4paper使得从标题跳转到下面的文本?\documentclass[a4paper]{article}顺便说一句,使用也有同样的问题。

答案1

注释太长了。下面是一个更简单的 MWE,其中 tikz 代码较少。请注意,%删除\strut

%\documentclass[a4paper]{article}
\documentclass[a4paper]{scrartcl}
\usepackage{lipsum,graphicx}
\usepackage[left=0mm,right=40mm]{geometry}

\usepackage{tikz}
\usetikzlibrary{calc}

\raggedbottom
\begin{document}

% placed here if some package or class decides on doing at begin
% document stuff
\setlength{\textfloatsep}{0bp}
\setlength{\intextsep}{0bp}
\setlength{\abovecaptionskip}{0bp}
\setlength{\belowcaptionskip}{0bp}

\renewcommand{\normalsize}{\fontsize{10bp}{12bp}\selectfont}

\normalsize


This is a \lipsum[1]%\strut

\begin{figure}[h]
    \centering
    \includegraphics[width=170mm,height=63.99mm]{example-image-a}%
    \caption[]{\tikz[baseline=(x.base),remember picture]{\node[inner
        sep=0pt,outer sep=0pt](x){Just};} a test g}%
\end{figure}

\noindent
\tikz[baseline=(y.base),remember picture]{\node[inner sep=0pt,outer
  sep=0pt](y){This};} is a line of text to show what happens below the
figure is a line of text to show what happens below the figure is a
line of text to show what happens below the figure
\tikz[baseline=(z.base),remember picture]{\node[inner sep=0pt,outer
  sep=0pt](z){This};}


\begin{tikzpicture}[remember picture, overlay,draw=red]%

  \draw (x.base west -| current page.west) -- (x.base west -| current page.east) coordinate (a);
  \draw (y.base west -| current page.west) -- (y.base west -| current page.east) coordinate (b);
  \draw (z.base west -| current page.west) -- (z.base west -| current page.east);

  \draw[->] ($(a)+(-3,0)$) -- ++(0,-12bp) node[midway,right] {\tiny 12bp arrow};
  \draw[->] ($(b)+(-3,0)$) -- ++(0,-12bp) node[midway,right] {\tiny 12bp arrow};

  
\end{tikzpicture}

\end{document}

相关内容