当我在文档中添加气泡时,我的纸张/页面尺寸就不再适用了

当我在文档中添加气泡时,我的纸张/页面尺寸就不再适用了

所以我正在做一个应该在 A5 上的项目。我有一个这种文档的模板,它一直运行良好。这是我通常使用的代码:

\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage{indentfirst}
\usepackage{comment}
\usepackage{geometry}
\begin{comment}

\end{comment}

 \geometry{
 a5paper,
 left=25mm,
 top=25mm,
 right=25mm,
 bottom=25mm
 }



  

\setlength{\parskip}{0.7em}



\begin{document}

\pagenumbering{gobble}
\chapter*{}
\chapter*{Title}
\vspace*{\fill}
\small Author
\chapter*{I}
\pagenumbering{arabic}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ullamcorper dapibus semper. Donec eros erat, placerat eu molestie et, bibendum sed magna. Aliquam congue massa magna. Fusce id tempor libero. Proin pulvinar lorem orci, pretium tincidunt sapien bibendum et. In justo ex, facilisis non enim iaculis, finibus tincidunt eros. Nulla hendrerit magna orci. Sed et sem eu est consectetur ullamcorper et eget urna. Suspendisse eros lacus, placerat eu lacus id, congue feugiat tellus. Nunc massa lectus, vulputate sed accumsan nec, placerat in risus. Phasellus in ullamcorper mauris. Sed porttitor enim diam, nec vulputate sem congue non. Nunc sed ullamcorper erat.

Praesent lorem turpis, lacinia pulvinar nulla eget, tincidunt efficitur ante. Vestibulum vitae semper sapien. Maecenas finibus ut mi eu cursus. Mauris ac mauris sed nibh efficitur commodo ut ultrices neque. Integer facilisis gravida urna nec sollicitudin. Donec fringilla fringilla turpis, vitae tincidunt lacus scelerisque et. Mauris non ipsum vitae ex eleifend commodo. In hac habitasse platea dictumst. Cras blandit blandit elementum. Nam ac tempus diam. Integer leo quam, pulvinar ut porttitor in, pretium nec sapien. Proin rhoncus lorem nec sodales commodo. Morbi maximus porttitor ex, sed viverra lorem vehicula et. Pellentesque malesuada urna quis nisi tincidunt interdum. Sed non neque vitae ante tincidunt lobortis.

\end{document}

现在我在中间添加了这段代码,以便能够使用对话气泡,但这破坏了格式。现在整个文本都偏向左边一半。要么就是页面尺寸不再是 A5。

\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage{indentfirst}
\usepackage{comment}
\usepackage{geometry}
\begin{comment}

\end{comment}

 \geometry{
 a5paper,
 left=25mm,
 top=25mm,
 right=25mm,
 bottom=25mm
 }



  

\setlength{\parskip}{0.7em}

\usepackage[many]{tcolorbox}
\usepackage{xcolor}
\usepackage{varwidth}
\usepackage{environ}
\usepackage{xparse}
\usepackage{emoji}

\newlength{\bubblesep}
\newlength{\bubblewidth}
\setlength{\bubblesep}{2pt}
\AtBeginDocument{\setlength{\bubblewidth}{.75\textwidth}}
\definecolor{bubblereceive}{RGB}{100,200,200}
\definecolor{bubblesend}{RGB}{241,240,240}

\newcommand{\bubble}[4]{%
  \tcbox[
    on line,
    arc=4.5mm,
    colback=#1,
    colframe=#1,
    #2,
  ]{\color{#3}\begin{varwidth}{\bubblewidth}#4\end{varwidth}}%
}

\ExplSyntaxOn
\seq_new:N \l__ooker_bubbles_seq
\tl_new:N \l__ooker_bubbles_first_tl
\tl_new:N \l__ooker_bubbles_last_tl

\NewEnviron{rightbubbles}
 {
  \begin{flushright}
  \sffamily
  \seq_set_split:NnV \l__ooker_bubbles_seq { \par } \BODY
  \int_compare:nTF { \seq_count:N \l__ooker_bubbles_seq < 2 }
   {
    \bubble{bubblesend}{rounded~corners}{black}{\BODY}\par
   }
   {
    \seq_pop_left:NN \l__ooker_bubbles_seq \l__ooker_bubbles_first_tl
    \seq_pop_right:NN \l__ooker_bubbles_seq \l__ooker_bubbles_last_tl
    \bubble{bubblesend}{sharp~corners=southeast}{black}{\l__ooker_bubbles_first_tl}
    \par\nointerlineskip
    \addvspace{\bubblesep}
    \seq_map_inline:Nn \l__ooker_bubbles_seq
     {
      \bubble{bubblesend}{sharp~corners=east}{black}{##1}
      \par\nointerlineskip
      \addvspace{\bubblesep}
     }
    \bubble{bubblesend}{sharp~corners=northeast}{black}{\l__ooker_bubbles_last_tl}
    \par
   }
   \end{flushright}
 }
\NewEnviron{leftbubbles}
 {
  \begin{flushleft}
  \sffamily
  \seq_set_split:NnV \l__ooker_bubbles_seq { \par } \BODY
  \int_compare:nTF { \seq_count:N \l__ooker_bubbles_seq < 2 }
   {
    \bubble{bubblereceive}{rounded~corners}{white}{\BODY}\par
   }
   {
    \seq_pop_left:NN \l__ooker_bubbles_seq \l__ooker_bubbles_first_tl
    \seq_pop_right:NN \l__ooker_bubbles_seq \l__ooker_bubbles_last_tl
    \bubble{bubblereceive}{sharp~corners=southwest}{white}{\l__ooker_bubbles_first_tl}
    \par\nointerlineskip
    \addvspace{\bubblesep}
    \seq_map_inline:Nn \l__ooker_bubbles_seq
     {
      \bubble{bubblereceive}{sharp~corners=west}{white}{##1}
      \par\nointerlineskip
      \addvspace{\bubblesep}
     }
    \bubble{bubblereceive}{sharp~corners=northwest}{white}{\l__ooker_bubbles_last_tl}\par
   }
  \end{flushleft}
 }
\ExplSyntaxOff



\begin{document}

\pagenumbering{gobble}
\chapter*{}
\chapter*{Title}
\vspace*{\fill}
\small Author
\chapter*{I}
\pagenumbering{arabic}
Sample.

\begin{rightbubbles}
Speech bubble
\end{rightbubbles}
\begin{rightbubbles}
Speech bubble
\end{rightbubbles}
\begin{rightbubbles}
Speech bubble
\end{rightbubbles}
\begin{leftbubbles}
Speech bubble
\end{leftbubbles}
\begin{rightbubbles}
Speech bubble
\end{rightbubbles}

\begin{leftbubbles}
Speech bubble
\end{leftbubbles}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ullamcorper dapibus semper. Donec eros erat, placerat eu molestie et, bibendum sed magna. Aliquam congue massa magna. Fusce id tempor libero. Proin pulvinar lorem orci, pretium tincidunt sapien bibendum et. In justo ex, facilisis non enim iaculis, finibus tincidunt eros. Nulla hendrerit magna orci. Sed et sem eu est consectetur ullamcorper et eget urna. Suspendisse eros lacus, placerat eu lacus id, congue feugiat tellus. Nunc massa lectus, vulputate sed accumsan nec, placerat in risus. Phasellus in ullamcorper mauris. Sed porttitor enim diam, nec vulputate sem congue non. Nunc sed ullamcorper erat.

Praesent lorem turpis, lacinia pulvinar nulla eget, tincidunt efficitur ante. Vestibulum vitae semper sapien. Maecenas finibus ut mi eu cursus. Mauris ac mauris sed nibh efficitur commodo ut ultrices neque. Integer facilisis gravida urna nec sollicitudin. Donec fringilla fringilla turpis, vitae tincidunt lacus scelerisque et. Mauris non ipsum vitae ex eleifend commodo. In hac habitasse platea dictumst. Cras blandit blandit elementum. Nam ac tempus diam. Integer leo quam, pulvinar ut porttitor in, pretium nec sapien. Proin rhoncus lorem nec sodales commodo. Morbi maximus porttitor ex, sed viverra lorem vehicula et. Pellentesque malesuada urna quis nisi tincidunt interdum. Sed non neque vitae ante tincidunt lobortis.

\end{document}

答案1

好吧,经过大约 2 个小时的反复尝试,我发现我只需要切换这个

\documentclass{memoir}

有了这个

\documentclass[a5paper]{memoir}

然后它又开始工作了。这很奇怪,因为我之前不需要包含这个位,而且当我没有对话气泡代码时它也能工作。

相关内容