为什么文本位于表格上方?

为什么文本位于表格上方?
%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\documentclass[12pt]{article}
\usepackage{array, booktabs}
\usepackage[x11names]{xcolor}
\usepackage{colortbl}
\usepackage{caption}
\DeclareCaptionFont{blue}{\color{LightSteelBlue3}}
\newcommand{\foo}{\color{LightSteelBlue3}\makebox[0pt]{\textbullet}\hskip-0.5pt\vrule width 1pt\hspace{\labelsep}}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{chronology}
\usepackage[TS1,T1]{fontenc}
\usepackage{fourier}

\begin{document}

\begin{titlepage}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Defines a new command for the horizontal lines, change thickness here

\center % Center everything on the page

%----------------------------------------------------------------------------------------
%   HEADING SECTIONS
%----------------------------------------------------------------------------------------

\textsc{\LARGE University of Abertay}\\[1.5cm] % Name of your university/college
\textsc{\Large BSC Web Development}\\[0.5cm] % Major heading such as course name

%----------------------------------------------------------------------------------------
%   TITLE SECTION
%----------------------------------------------------------------------------------------

\HRule \\[0.4cm]
{ \huge \bfseries Key social media concepts, technologies and strategies}\\[0.4cm] % Title of your document
\HRule \\[1.5cm]

%----------------------------------------------------------------------------------------
%   AUTHOR SECTION
%----------------------------------------------------------------------------------------

\begin{minipage}{0.4\textwidth}
\begin{flushleft} \large
\emph{Author:}\\
Joshua \textsc{Dempsey} % Your name
\end{flushleft}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\begin{flushright} \large
\emph{Supervisor:} \\
Shona \textsc{Irvine} % Supervisor's Name
\end{flushright}
\end{minipage}\\[2cm]

% If you don't want a supervisor, uncomment the two lines below and remove the section above
%\Large \emph{Author:}\\
%John \textsc{Smith}\\[3cm] % Your name

%----------------------------------------------------------------------------------------
%   DATE SECTION
%----------------------------------------------------------------------------------------

{\large \today}\\[2cm] % Date, change the \today to a set date if you want to be precise

%-----------------------------------------------------------------------------------
%   LOGO SECTION
%----------------------------------------------------------------------------------------

\includegraphics[width=5cm,height=4cm]{logo.png} % Include a department/university logo - this will require the graphicx package

%----------------------------------------------------------------------------------------

\vfill % Fill the rest of the page with whitespace

\end{titlepage}


\begin{abstract}
The aim of this research is to establish the history behind social media and examine its evolution through the ages to the current day. I will also reflect on social media's use in society today and examine the ways in which social media negatively and positively affects our lives.

To conduct my research  I will utilise numerous third party websites \\- all of which will be referenced at the end of the document. I will also rely on personal anecdotes from myself and friends. Any information not referenced can be assumed to be a personal anecdote.
\end{abstract}

\newpage

\section{Evolution of social media}

Whether it's \textbf{\textit{"checking in"}} to a restaurant they are visiting, posting pictures from a holiday, live streaming a sports event or communicating with relatives on the other side of the world, it's fair to say that most people do not appreciate the history behind social media and take it for granted.

Behind all of the worlds most popular social media applications however, lies a great deal of history, dating all the way back to the stone ages. Below is a time line detailing the spectacular and fast paced history and evolution of social media, and underneath a brief description of the events included on the time line.
\newpage
\begin{table}

\renewcommand\arraystretch{1.4}\arrayrulecolor{LightSteelBlue3}
\captionsetup{singlelinecheck=false, font=blue, labelfont=sc, labelsep=quad}
\caption{Timeline of Social Media}\vskip -1.5ex
\begin{tabular}{@{\,}r <{\hskip 4pt} !{\foo} >{\raggedright\arraybackslash}p{7cm}}

Late 70's & Bulletin Board Systems \textbf{\textit{"BBS"}} were initially conceived \\
1979 & Usenet was developed by Tom Truscott and Jim Ellis \\
1980's & Compuserve and Prodigy were launched \\
1985 & Genie was created and launched by General Electric \\
1988 & IRC was created \\
1990's & ICQ was developed in the mid 1990's \\
1997 & Six degrees was launched \\
1997 - 2001 & AsianAvenue, MiGente, BlackPlanet \\
1999 & LiveJournal was created\\
2000 & Many social games were becoming increasingly popular \\
2002 & Friendster was launched \\
2003 & Hi5, LinkedIn, Myspace, PhotoBucket were all launched \\
2004 & Facebook, Orkut, Flickr were launched \\
2005 & YouTube, Reddit were launched \\ 
2006 & Twitter, uStream were launched \\
2007 & Tumblr was launched \\
2010 & Pinterest launched \\
2011 & Snapchat, Google+ launched \\
2012 & Dating app Tinder launched \\
2015 & Periscope launched

\end{tabular}
\end{table}

As we can see, the history and evolution is one that is long and chequered. The timeline above is by no means exhaustive and is only showing the main applications and services which people have used the world over - there is a whole world of smaller, more localised applications and services that are out-with the remit of this report. 
\end{document}

上面是我正在编写的报告的一些代码。让我感到困惑的是:在 Latex 文档中,表格出现在以“我们可以看到,历史和演变是漫长而复杂的...”开头的段落之前,但是输出却将其翻转,因此文本出现在表格之前。我尝试过谷歌搜索并在线寻找解决方案,但作为 Latex 的新用户,我不太确定从哪里开始。

代码托管在这里:https://www.overleaf.com/read/cjzzszzprptk

任何帮助都将不胜感激。

答案1

table环境不能跨页。您的table(由标题和tabular环境组成,右侧列“仅”7cm宽,迫使相当多的行“换行”)太高,无法放在已经包含节标题和两个段落的页面上。那么,LaTeX 能做的最好的事情就是将table单独放在页面上。(这就是“浮动环境”中的“浮动”的意思。)

如果您不希望表格材料以这种方式浮动,并且如果您不介意在表格材料中的某个地方出现分页符,则您不应该一开始就使用table/tabular组合。相反,请考虑使用环境longtable。以下代码实现了此建议。在下面的代码中,我取消了标题和摘要页面,因为它们与当前主题无关。

在此处输入图片描述 在此处输入图片描述

\documentclass[12pt]{article}
\usepackage{array, booktabs, longtable}
\usepackage[x11names,table]{xcolor}
\usepackage{caption}
\DeclareCaptionFont{blue}{\color{LightSteelBlue3}}
\newcommand{\foo}{\color{LightSteelBlue3}
    \makebox[0pt]{\textbullet}\hskip-0.5pt
    \vrule width 1pt
    \hspace{\labelsep}}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage[demo]{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{chronology}
\usepackage[TS1,T1]{fontenc}
\usepackage{fourier}

\begin{document}

\section{Evolution of social media}

Whether it's \textbf{\textit{``checking in''}} to a restaurant they are visiting, posting pictures from a holiday, live streaming a sports event or communicating with relatives on the other side of the world, it's fair to say that most people do not appreciate the history behind social media and take it for granted.

Behind all of the world's most popular social media applications, however, lies a great deal of history, dating all the way back to the stone age. Below is a time line detailing the spectacular and fast paced history and evolution of social media, and underneath a brief description of the events included on the time line.

\begingroup  
\renewcommand\arraystretch{1.4}
\arrayrulecolor{LightSteelBlue3}
\captionsetup{font=blue, labelfont=sc, labelsep=quad}
\begin{longtable}{r <{\hspace{4pt}} !{\foo} 
     >{\raggedright\arraybackslash}p{7cm}}
\caption{Timeline of Social Media\label{tab:1}}\\
\endfirsthead
\caption*{(Table \ref{tab:1}, continued)}\\
\endhead
\multicolumn{2}{r}{(continued)}
\endfoot
\endlastfoot
Late 70's & Bulletin Board Systems \textbf{\textit{``BBS''}} initially conceived \\
1979 & Usenet developed by Tom Truscott and Jim Ellis \\
1980's & Compuserve and Prodigy launched \\
1985 & Genie created and launched by General Electric \\
1988 & IRC created \\
1990's & ICQ developed in the mid 1990's \\
1997 & Six degrees  launched \\
1997--2001 & AsianAvenue, MiGente, BlackPlanet \\
1999 & LiveJournal created\\
2000 & Many social games becoming increasingly popular \\
2002 & Friendster launched \\
2003 & Hi5, LinkedIn, Myspace, PhotoBucket all launched \\
2004 & Facebook, Orkut, Flickr launched \\
2005 & YouTube, Reddit launched \\ 
2006 & Twitter, uStream launched \\
2007 & Tumblr launched \\
2010 & Pinterest launched \\
2011 & Snapchat, Google+ launched \\
2012 & Dating app Tinder launched \\
2015 & Periscope launched\\
\end{longtable}
\endgroup

As we can see, the history and evolution are long and chequered. The timeline is by no means exhaustive, and it only shows the main applications and services which people have used the world over---there is a whole world of smaller, more localised applications and services that are out---with the remit of this report. 

\end{document}

答案2

我建议使用包,它结合了和ltablex的可能性。简而言之,如果需要,表格可以跨页拆分。tabularxlongtable

我以为这些\newpage命令是为了让表格出现在你想要的地方,所以我擅自删除了它们。我还用印刷引号替换了你的程序员的引号。

希望结果更符合您的要求:

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\documentclass[12pt]{article}
\usepackage[TS1,T1]{fontenc}
\usepackage{fourier}

\usepackage{array, booktabs}
\usepackage[x11names]{xcolor}
\usepackage{colortbl}
\usepackage{caption}
\DeclareCaptionFont{blue}{\color{LightSteelBlue3}}
\newcommand{\foo}{\color{LightSteelBlue3}\makebox[0pt]{\textbullet}\hskip-0.5pt\vrule width 1pt\hspace{\labelsep}}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{chronology}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Defines a new command for the horizontal lines, change thickness here
\usepackage{ltablex}

\begin{document}
%
\begin{titlepage}

  \centering % Center everything on the page

  %----------------------------------------------------------------------------------------
  % HEADING SECTIONS
  %----------------------------------------------------------------------------------------

  \textsc{\LARGE University of Abertay}\\[1.5cm] % Name of your university/college
  \textsc{\Large BSC Web Development}\\[0.5cm] % Major heading such as course name

  %----------------------------------------------------------------------------------------
  % TITLE SECTION
  %----------------------------------------------------------------------------------------

  \HRule \\[0.4cm]
  { \huge \bfseries Key social media concepts, technologies and strategies}\\[0.4cm] % Title of your document
  \HRule \\[1.5cm]

  %----------------------------------------------------------------------------------------
  % AUTHOR SECTION
  %----------------------------------------------------------------------------------------

  \begin{minipage}{0.4\textwidth}
    \begin{flushleft} \large
      \emph{Author:}\\
      Joshua \textsc{Dempsey} % Your name
    \end{flushleft}
  \end{minipage}
  \begin{minipage}{0.4\textwidth}
    \begin{flushright} \large
      \emph{Supervisor:} \\
      Shona \textsc{Irvine} % Supervisor's Name
    \end{flushright}
  \end{minipage}\\[2cm]

  % If you don't want a supervisor, uncomment the two lines below and remove the section above
  %\Large \emph{Author:}\\
  %John \textsc{Smith}\\[3cm] % Your name

  %----------------------------------------------------------------------------------------
  % DATE SECTION
  %----------------------------------------------------------------------------------------

  {\large \today}\\[2cm] % Date, change the \today to a set date if you want to be precise

  %-----------------------------------------------------------------------------------
  % LOGO SECTION
  %----------------------------------------------------------------------------------------

  %\includegraphics[width=5cm,height=4cm]{logo.png} % Include a department/university logo - this will require the graphicx package

  %----------------------------------------------------------------------------------------

  \vfill % Fill the rest of the page with whitespace

\end{titlepage}

\begin{abstract}
  The aim of this research is to establish the history behind social media and examine its evolution through the ages to the current day. I will also reflect on social media's use in society today and examine the ways in which social media negatively and positively affects our lives.

  To conduct my research I will utilise numerous third party websites -- all of which will be referenced at the end of the document. I will also rely on personal anecdotes from myself and friends. Any information not referenced can be assumed to be a personal anecdote.
\end{abstract}

\newpage

\section{Evolution of social media}

Whether it's \textbf{\textit{“checking in”}} to a restaurant they are visiting, posting pictures from a holiday, live streaming a sports event or communicating with relatives on the other side of the world, it's fair to say that most people do not appreciate the history behind social media and take it for granted.

Behind all of the worlds most popular social media applications however, lies a great deal of history, dating all the way back to the stone ages. Below is a time line detailing the spectacular and fast paced history and evolution of social media, and underneath a brief description of the events included on the time line.

\renewcommand\arraystretch{1.25}\arrayrulecolor{LightSteelBlue3}
\captionsetup{singlelinecheck=false, font=blue, labelfont=sc, labelsep=quad}
\begin{tabularx}{\linewidth}{@{\,}r <{\hskip 4pt} !{\foo} >{\raggedright\arraybackslash}X}%p{10cm}
  \caption{Timeline of Social Media}\vspace*{-1ex}
  \endfirsthead
  \multicolumn{2}{l}{\color{LightSteelBlue3}Timeline of Social Media\quad(continued)\vspace{1ex}}
  \endhead
  \multicolumn{2}{r}{\footnotesize\itshape To be continued}
  \endfoot
  \endlastfoot
  Late 70's & Bulletin Board Systems \textbf{\textit{“BBS”}} were initially conceived \\
  1979 & Usenet was developed by Tom Truscott and Jim Ellis \\
  1980's & Compuserve and Prodigy were launched \\
  1985 & Genie was created and launched by General Electric \\
  1988 & IRC was created \\
  1990's & ICQ was developed in the mid 1990's \\
  1997 & Six degrees was launched \\
  1997--2001 & AsianAvenue, MiGente, BlackPlanet \\
  1999 & LiveJournal was created \\
  2000 & Many social games were becoming increasingly popular \\
  2002 & Friendster was launched \\
  2003 & Hi5, LinkedIn, Myspace, PhotoBucket were all launched \\
  2004 & Facebook, Orkut, Flickr were launched \\
  2005 & YouTube, Reddit were launched \\
  2006 & Twitter, uStream were launched \\
  2007 & Tumblr was launched \\
  2010 & Pinterest launched \\
  2011 & Snapchat, Google+ launched \\
  2012 & Dating app Tinder launched \\
  2015 & Periscope launched
\end{tabularx}

As we can see, the history and evolution is one that is long and chequered. The timeline above is by no means exhaustive and is only showing the main applications and services which people have used the world over - there is a whole world of smaller, more localised applications and services that are out-with the remit of this report.

\end{document} 

在此处输入图片描述

相关内容