如何使表格/图形不放置在段落中间(图形/表格自动分割段落)?

如何使表格/图形不放置在段落中间(图形/表格自动分割段落)?

我不希望我的图形/表格被放置在段落的中间以致于将其分割。

我曾经尝试过

\begin{table}[htp!]

\begin{table}[h!]

还是行不通 在此处输入图片描述

第二个例子是表格在新页面上自动拆分段落。

在此处输入图片描述

妇女权利委员会:

\documentclass[12pt,oneside]{book}

 \usepackage{showframe}
 \renewcommand\ShowFrameLinethickness{0.15pt}
 \renewcommand*\ShowFrameColor{\color{red}}

\usepackage{makecell,siunitx}
\usepackage{booktabs}
\usepackage{graphicx}

\usepackage{parskip} % <================================================
\usepackage{caption} % <================================================


\begin{document} 

"When entering the door at Lou's, two things are immediately noticeable: the place is rarely empty and seems to consist of a maze of rooms. The first room, through the door, is the main part of the restaurant. There is another, rarely used, dining room off to the right. It was added during the oil well boom of the seventies. Through the main dining room is yet another room; it guards the door leading into the kitchen. This room contains the most coveted table in the place. The highest tribute Lou can bestow on anyone is to allow them access to seats at this table. This table is the family table; it is reserved for Lou's, and her daughter Karen's, immediate family and treasured friends."

"Like his twisted feathers, his many scars, the reliable old owl chose the gnarled, weather-beaten, but solid branch often - it being a companion to the wise alone with the night and the last branch to creak in the heaviest wind. He often came to survey the fields and the clouds before his hunt, to listen to the steady sound of the stream passing through reeds under the bridge, while combing his feathers for the unwanteds - whatever they might be."

"Looking back on a childhood filled with events and memories, I find it rather difficult to pick one that leaves me with the fabled "warm and fuzzy feelings." As the daughter of an Air Force major, I had the pleasure of traveling across America in many moving trips. I have visited the monstrous trees of the Sequoia National Forest, stood on the edge of the Grand Canyon and have jumped on the beds at Caesar's Palace in Lake Tahoe."

"When entering the door at Lou's, two things are immediately noticeable: the place is rarely empty and seems to consist of a maze of rooms. The first room, through the door, is the main part of the restaurant. There is another, rarely used, dining room off to the right. It was added during the oil well boom of the seventies. Through the main dining room is yet another room; it guards the door leading into the kitchen. This room contains the most coveted table in the place. The highest tribute Lou can bestow on anyone is to allow them access to seats at this table. This table is the family table; it is reserved for Lou's, and her daughter Karen's, immediate family and treasured friends."


\begin{figure}[h!]
    \centering
    \includegraphics[scale=0.2]{name/PilotStudy.png}
    \caption{Test}
    \label{fig:Test}
\end{figure}



"The day I picked my dog up from the pound was one of the happiest days of both of our lives. I had gone to the pound just a week earlier with the idea that I would just "look" at a puppy. Of course, you can no more just look at those squiggling little faces so filled with hope and joy than you can stop the sun from setting in the evening. I knew within minutes of walking in the door that I would get a puppy… but it wasn't until I saw him that I knew I had found my puppy."

"Looking for houses was supposed to be a fun and exciting process. Unfortunately, none of the ones that we saw seemed to match the specifications that we had established. They were too small, too impersonal, too close to the neighbors. After days of finding nothing even close, we began to wonder: was there really a perfect house out there for us?"

Below is a pdf link to personal statements and application essays representing strong efforts by students applying for both undergraduate and graduate opportunities. These ten essays have one thing in common: They were all written by students under the constraint of the essay being 1-2 pages due to the target program’s explicit instructions. In such circumstances, writers must attend carefully to the essay prompt (sometimes as simple as “Write a one-page summary of your reasons for wanting to pursue graduate study”) and recognize that evaluators tend to judge these essays on the same fundamental principles, as follows:

\begin{table}[htp!]
\centering
\begin{tabular}{%
  l
  S[table-format=2.2,table-space-text-post=\%]
  S[table-format=3.2,,table-space-text-post=\%]
}
\toprule
    & \multicolumn{2}{c}{\thead{\makebox[0pt]{\textbf{Descriptive Analysis 1}}}}\\ 
     \cmidrule{2-3}
& \textbf{MM}
& \textbf{CM} \\
\midrule
N       & {10}  &  {10}      \\
    Mean    & 91.45\%  & 8.55\% \\
    Median  & 94.74\%  & 5.26\% \\
\bottomrule
\end{tabular}
\captionof{table}{the wantet title of table} % <========================
\label{tab:title} % <===================================================
\end{table}

"Billy Ray's Pawn Shop and Lawn Mower Repair looked like a burial ground for country auction rejects. The blazing, red, diesel fuel tanks beamed in front of the station, looking like cheap lipstick against the pallid, wrinkled texture of the parking lot sand. The yard, not much larger than the end zone at General G. Patton High School on the north end of town, was framed with a rusted metallic hedge of lawn mowers, banana seat bicycles, and corroded oil drums. It wasn't a calico frame of rusted parts, but rather an orchestra of unwanted machinery that Billy Ray had arranged into sections. The yellow-tanked mowers rested silently at the right of the diesel fuel. Once red, now faded orange, mowers stood at attention to the left. The oil barrels, jaded and pierced with holes, bellared like chimes when the wind was right. The bikes rested sporadically throughout the lot. In the middle of it all was the office, a faded, steel roof supported by cheap two-by-fours and zebra paneling. Billy Ray was at home, usually, five blocks east of town on Kennel Road."

\begin{center}
\begin{tabular}{%
  l
  S[table-format=2.2,table-space-text-post=\%]
  S[table-format=3.2,,table-space-text-post=\%]
}
\toprule
    & \multicolumn{2}{c}{\thead{\makebox[0pt]{\textbf{Descriptive Analysis 1}}}}\\ 
     \cmidrule{2-3}
& \textbf{MM}
& \textbf{CM} \\
\midrule
N       & {10}  &  {10}      \\
    Mean    & 91.45\%  & 8.55\% \\
    Median  & 94.74\%  & 5.26\% \\
\bottomrule
\end{tabular}
\captionof{figure}{the wantet title of table} % <========================
\label{tab:title} % <===================================================
\end{center}


"When entering the door at Lou's, two things are immediately noticeable: the place is rarely empty and seems to consist of a maze of rooms. The first room, through the door, is the main part of the restaurant. There is another, rarely used, dining room off to the right. It was added during the oil well boom of the seventies. Through the main dining room is yet another room; it guards the door leading into the kitchen. This room contains the most coveted table in the place. The highest tribute Lou can bestow on anyone is to allow them access to seats at this table. This table is the family table; it is reserved for Lou's, and her daughter Karen's, immediate family and treasured friends.

\end{document}

答案1

下面是一个在文档中使用说明符定位图像的示例H。它清楚而响亮地表明了为什么你的意图与良好的排版相悖,以及为什么你应该尽可能避免:

\documentclass[12pt,oneside]{book}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}
\usepackage{siunitx}
\usepackage{booktabs, makecell}
\usepackage{float}  % <--- for "H" float positioning specification 
\usepackage{graphicx}
\usepackage{caption} 

\usepackage{parskip}

\begin{document}
\lipsum[1-2]
\begin{figure}[H] % for comparison replace "H" with "htb
\includegraphics[width=\linewidth]{example-image-duck}
    \caption{Test}
    \label{fig:Test}
\end{figure}
\lipsum[3-4]
\begin{figure}[H] % for comparison replace "H" with "htb
\includegraphics[width=\linewidth]{example-image-duck}
    \caption{Test}
    \label{fig:Test}
\end{figure}
\lipsum[5-7]
\end{document}

为了进行比较,请用 替换[H][htb]差异明显且巨大。但这取决于您喜欢什么。我会坚持使用[htb]

顺便说一句,LaTeX 相对于 Word 的主要优势之一是能够自动移动图形和表格,以便您获得漂亮的文档。

答案2

另一种方法与 Zarko 的想法相同,即使用 minipage、makebox 和 caption 包。您无需使用图形环境,caption 的 captionof 命令将完成所有需要的操作,对于图形和表格也是如此。

\documentclass[12pt,oneside]{book}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum} 
\usepackage{graphicx}
\usepackage{caption} 

%\captionsetup{figurewithin=} --use it if figure count isn't continuously
%\captionsetup{figurewithin=,tablewithin=} --uncomment if figure and table 
%counters isn't continuously
%see the caption documentation to learn more about captionsetup

\begin{document}
\lipsum[1-2]

\noindent%
\begin{minipage}{\linewidth}%
\makebox[\linewidth]{%
\includegraphics[width=\linewidth]{example-image}}
    \captionof{figure}{Test}
    \label{fig:Test}
\end{minipage}

\lipsum[3-4]

\begin{minipage}{\linewidth}%
\makebox[\linewidth]{%
    \begin{tabular}{lcc}
    \hline
    Test & A & B \\
    Test & C & D \\
    \hline
    \end{tabular}}
    \captionof{table}{Test}
    \label{tabl:Test}
\end{minipage}

\lipsum[5-7]
\end{document}

带图页面

带有表格的页面

相关内容