一位校友给了我们一个写作课模板。模板中已经定义了一个“过渡”环境。我修复了线条和箭头之间的错位,但只要过渡之后有一个章节或小节,它就会跳过一页,而没有它就不会跳过。这个环境的重点是放在章节之前,所以这很令人沮丧。
这是 MWE 和相关图片。
\documentclass{article}
\usepackage[tikz]{bclogo}
\usepackage{lipsum}
\newcommand{\transition}[1]{
\begin{samepage}
\noindent \begin{bclogo}[barre = line, noborder = true, epBarre=2.0, logo=\ ]{} \vspace{0. em}\textit{#1} \end{bclogo}
\vspace*{-4.8 em}
\begin{flushleft}
\hspace{0.38 em}
\begin{tikzpicture}
\node (a) {};
\node (b) [below of=a] {};
\draw[-latex, line width = .2em] (a) -- (b);
\end{tikzpicture}
\end{flushleft}
\vspace*{-3.3 em}
\end{samepage}}
\begin{document}
\lipsum[1-4]
Just a bit more text to be a relevant MWE. Just a bit more text to be a relevant MWE. Just a bit more text to be a relevant MWE. Just a bit more text to be a relevant MWE. Just a bit more text to be a relevant MWE. Just a bit more text to be a relevant MWE.
\transition{This is cut on two pages, while there is still a lot of space on the first one! I'm only writing a short transition between two parts but it stills skip a page. That is annoying.}
\section{Test}
\end{document}
有人知道这个问题吗?我对 bclogos 了解不多,这个问题似乎与命令有关samepage
,但我不知道如何在不添加一些难看的前缀的情况下防止这种情况发生\vspace*{}
。有时甚至不可能,请参见下图。
多谢!
答案1
我其实不知道该怎么bclogo
做,我也不读法语。所以我猜可能需要什么。这是纯 Ti钾Z 版本\transition
,它接受一个可选命令,以防您想要一个过渡文本的标题。\mylogo
可以重新定义为您想要的徽标。
这个想法是,把所有东西都放在一个单一的盒子里,tikzpicture
意味着它将永远停留在同一页上。这是一个单一的盒子。
\documentclass{article}
\usepackage{lipsum,calc,tikz}
\usetikzlibrary{arrows.meta}
\newcommand\mylogo{\includegraphics[height=5mm]{cauldron}}% substitute whatever you want here
\newcommand{\transition}[2][]{%
\medskip
\par
\noindent
\begin{tikzpicture}
\node (a) [font=\itshape, align=justify, inner sep=0pt, text width=\linewidth-\parindent] {#2};
\draw [line width=.2em, -Latex] (a.north west) ++(-.75\parindent,0) coordinate (b) -- (a.south -| b);
\node (c) [anchor=south] at (b) {\mylogo};
\node [anchor=west, inner xsep=0pt, font=\sffamily\bfseries] at (c.center -| a.west) {#1};
\end{tikzpicture}}
\begin{document}
\lipsum[1-4]
Just a bit more text to be a relevant MWE.
Just a bit more text to be a relevant MWE.
Just a bit more text to be a relevant MWE.
Just a bit more text to be a relevant MWE.
Just a bit more text to be a relevant MWE.
Just a bit more text to be a relevant MWE.
Just a bit more text to be a relevant MWE.
Just a bit more text to be a relevant MWE.
Just a bit more text to be a relevant MWE.
\transition[Optional Title]{This is cut on two pages, while there is still a lot of space on the first one! I'm only writing a short transition between two parts but it stills skip a page. That is annoying.}
\section{Test}
\end{document}