从我的 stackon 泄露的样式

从我的 stackon 泄露的样式
\documentclass[12pt]{article}
\usepackage{verbatimbox,stackengine,xcolor,hyperref}
\usepackage[left=2cm,right=2cm]{geometry}

\begin{document}

\title{}
\author{}

\maketitle

\section{Overview}
There are two major file types you need to know about when writing tests in Robot Framework and they are the Resource file and the Test Suite. Each test suite can contain multiple test cases, which are comprised of individual test scripts. You must designate the resource file for each test suite, to do so you must define your \textit{\textbf{Resource}} in the \textit{Settings} section eg.\\[1\baselineskip]

\begin{verbbox}
*** Settings ***
Documentation     A resource file with reusable keywords and variables.

Library           Selenium2Library
Library           FakerLibrary    WITH NAME    faker
Library           DateTime    WITH NAME    DateTime
\end{verbbox}
{\centering\stackon[12pt]{\footnotesize\parbox{\textwidth}{ The \textit{Library} keyword tells Robot that it needs to make sure that this is installed and available to use, otherwise it will tell you that importing the library failed. Selenium is needed in \textbf{all} of our resource files.}}{\theverbbox}\\[1\baselineskip]

In the above example I have imported two optional libraries (faker and DateTime). faker creates random data that can be used to populate fields, DateTime allows me to get the current date among other helpful functions. I have also used the \textit{WITH NAME} argument, I have done so because it will make it more obvious to anyone new to Robot Framework tests which functions are being called from these libraries. I did \textbf{not} do this for Selenium because Selenium is the base of most Robot Framework functionality and would not serve to clarify the function of our tests.\\[1\baselineskip]

Example of library keywords:\\[1\baselineskip]

\begin{verbbox}
${DATE}=    | DateTime.Get Current Date | result_format=%Y-%m-%d
\end{verbbox}

{\centering\stackon[12pt]{\footnotesize\parbox{\textwidth}{ This variable uses the function \textit{Get Current Date} from the \textbf{DateTime} library, you can tell because it uses the prefix that I defined in my earlier example before calling the function.}}{\theverbbox}%
  \par}\bigskip

\bigskip

To define a variable you must first define the \textbf{\textit{Variables}} section of the resource file
\begin{verbatim}
*** Variables ***
${variable name}    variable definition
${variable name} | variable definition
\end{verbatim}

\end{document}

在上面我的代码中,文本居中已经泄漏到此后的所有内容,我认为我已经关闭了“居中”,并且它不会影响其标签之外的任何内容?

为什么造型会泄露?我该如何阻止它?

提前致谢。

答案1

在您的示例中,您使用 紧接着 来启动一个组{\centering但该组永远不会以 结束}。因此,\centering将在文档的其余部分保持有效,并且您会TeX在日志中收到一些投诉(但不是错误):

(\end occurred inside a group at level 1)

### simple group (level 1) entered at line 60 ({)
### bottom level

可以通过在文档应该\centering结束的位置添加右括号来解决此问题。

相关内容