编辑:我也包含了文档中的所有包(我知道太多了。由于我仍然是 Latex 的初学者,因此当我尝试在论坛上找到的东西时,我会添加每个新包)。
我有一个关于表格布局的问题。在我的论文中,我必须列出所有利益相关者的名字,为此我创建了一个附录。表格本身应该适合章节标题所在的页面,但是无论我怎么努力,表格都会放在一个新页面上(即使我使用 将表格缩小很多\scriptsize
,它还是放不下)。我使用的代码是:
\documentclass[12pt,a4paper,twoside,openright]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[a4paper, total={6.8in, 9in}]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{comment}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{gensymb}
\usepackage[hidelinks,draft]{hyperref}
\def\UrlBreaks{\do\/\do-}
\usepackage{pdfpages}
\usepackage[official]{eurosym}
\usepackage{wasysym}
\usepackage{multirow}
\usepackage{accents}
\usepackage{verbatim}
\usepackage{fancyhdr}
\usepackage{multicol}
\usepackage{blindtext}
\graphicspath{ {figures/} }
\usepackage{array}
\usepackage[none]{hyphenat}
\usepackage{enumitem}
\usepackage{subcaption}
\usepackage[titletoc]{appendix}
\usepackage{pdflscape}
\usepackage[normalem]{ulem}
\useunder{\uline}{\ul}{}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{rotfloat}
\usepackage{newclude}
\usepackage{csquotes}
\usepackage{natbib}
\usepackage{chngcntr}
\counterwithout{table}{chapter}
\counterwithout{figure}{chapter}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage[nonumberlist, acronym]{glossaries}
\makeglossaries
\usepackage{wrapfig}
\usepackage{calligra}
\usepackage{booktabs}
\usepackage[normalem]{ulem}
\useunder{\uline}{\ul}{}
\usepackage{varwidth}
%----------------------------------------------------------------------------------------
% Chapter settings
%----------------------------------------------------------------------------------------
\usepackage{titlesec, blindtext, color}
\definecolor{gray75}{gray}{0.75}
\newcommand{\hsp}{\hspace{20pt}}
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
%%% Add this %%%
\titlespacing*{\chapter}{0pt}{0}{15pt}
\titlespacing*{name=\chapter, numberless}{0pt}{-30pt}{10pt}
%\titlespacing*{\chapter}{0pt}{30pt}{30pt} Original values
%\titlespacing*{name=\chapter,numberless}{0pt}{-30pt}{10pt} Original values
%%% End %%%
\begin{document}
\chapter{Project stakeholders} \label{app:stakeanal}
\begin{table}[htp]
\centering
\rotatebox{90}{%
\begin{varwidth}{\textheight}
\caption{Stakeholder analysis}\label{my-label}
\footnotesize
\begin{tabular}{@{}lllll@{}}
\toprule
\textbf{Stakeholder} & \textbf{Position} & \textbf{Interest} &
\textbf{Influence} & \textbf{Key interest} \\
\midrule
Name & Position & Medium & High & Description \\
Name & Position & Medium & High & Description \\
Name & Position & Medium & High & Description \\
Name & Position & Medium & High & Description \\
\bottomrule
\end{tabular}
\end{varwidth}%
}
\end{table}
你们能帮我修复一下吗?看上去很简单,其实很难!我也尝试过使用横向布局,但这也不可能,因为我不想让我的章节标题从顶部垂直位置变为顶部水平位置。
答案1
和sidewaystable
浮动将总是转到新页面。
\documentclass{book}
\usepackage{rotating,booktabs,varwidth}
\begin{document}
\chapter{Project stakeholders} \label{app:stakeanal}
\begin{table}[htp]
\centering
\rotatebox{90}{%
\begin{varwidth}{\textheight}
\caption{Stakeholder analysis}\label{my-label}
\footnotesize
\begin{tabular}{@{}lllll@{}}
\toprule
\textbf{Stakeholder} & \textbf{Position} & \textbf{Interest} &
\textbf{Influence} & \textbf{Key interest} \\
\midrule
Name & Position & Medium & High & Description \\
Name & Position & Medium & High & Description \\
Name & Position & Medium & High & Description \\
Name & Position & Medium & High & Description \\
\bottomrule
\end{tabular}
\end{varwidth}%
}
\end{table}
\end{document}