![表格格式等于页面大小](https://linux22.com/image/327224/%E8%A1%A8%E6%A0%BC%E6%A0%BC%E5%BC%8F%E7%AD%89%E4%BA%8E%E9%A1%B5%E9%9D%A2%E5%A4%A7%E5%B0%8F.png)
我一直在论坛上寻找答案,但不幸的是,我找不到问题的答案。如下所示,我使用了一个表格。该表格包含两列,我希望第一列更宽,但表格不会位于页面中间。我希望表格从页面左侧开始。
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{fullpage}
\usepackage{longtable}
\title{Equations in chapters}
\author{Student NL}
\begin{document}
\maketitle
\textbf{Given information}
\begin{longtable}{l p{12cm}}
Demand Mediamarkt Essen (ME) & 35 per day\\
Demand Mediamarkt Neuss (MN) & 20 per day\\
Demand Mediamarkt Aachen (MA) & 42 per day\\
\\
Cost each trip ME & 1,100 \\
Cost each trip MN & 1,300 \\
Cost each trip MA & 1,500 \\
\\
Purchase price per cooker & 78 \\
Number of days in year & 365 \\
Holding cost rate for each store & 20 percent per year \\
\end{longtable}
\end{document}
我怎样才能做到这一点?
答案1
这是一个解决方案,两个表格有一些区别。您需要设置\firstcol
第一列的宽度,第二列将由 pdftex 计算
\documentclass{article}
\usepackage{longtable}
\newcommand*{\firstcol}{10cm}
\newcommand*{\secondcol}{\dimexpr\textwidth-\firstcol-4\tabcolsep\relax}
\title{Equations in chapters}
\author{Student NL}
\begin{document}
\maketitle
\textbf{Given information}\\
\begin{longtable}{p{\firstcol}p{\secondcol}}
\hline
Demand Mediamarkt Essen (ME) & 35 per day\\
Demand Mediamarkt Neuss (MN) & 20 per day\\
Demand Mediamarkt Aachen (MA) & 42 per day\\
\\
Cost each trip ME & 1,100 \\
Cost each trip MN & 1,300 \\
Cost each trip MA & 1,500 \\
\\
Purchase price per cooker & 78 \\
Number of days in year & 365 \\
Holding cost rate for each store & 20 percent per year \\
\end{longtable}
%\renewcommand*{\firstcol}{10cm}
\renewcommand*{\secondcol}{\dimexpr\textwidth-\firstcol-2\tabcolsep\relax}
\begin{longtable}{@{}p{\firstcol}p{\secondcol}@{}}
\hline
Demand Mediamarkt Essen (ME) & 35 per day\\
Demand Mediamarkt Neuss (MN) & 20 per day\\
Demand Mediamarkt Aachen (MA) & 42 per day\\
\\
Cost each trip ME & 1,100 \\
Cost each trip MN & 1,300 \\
Cost each trip MA & 1,500 \\
\\
Purchase price per cooker & 78 \\
Number of days in year & 365 \\
Holding cost rate for each store & 20 percent per year \\
\end{longtable}
\end{document}
答案2
我希望 [长] 表从 [文本块] 的左侧 [边缘] 开始。
您需要 (a) 修改长度参数的值\LTleft
,以及\LTright
(b) 确保最左列左侧没有空格。以下 MWE(最小工作示例)满足这些要求:
\documentclass{report}
\usepackage{longtable}
\setlength\LTleft{0pt} % no padding on the left
\setlength\LTright\fill % "infinite padding on the right
\begin{document}
\hrule % Just to illustrate the width of the textblock
\begin{longtable}{@{} l p{12cm} } % <- note the "@{}" particle
Demand Mediamarkt Essen (ME) & 35 per day\\
Demand Mediamarkt Neuss (MN) & 20 per day\\
Demand Mediamarkt Aachen (MA) & 42 per day\\
\end{longtable}
\end{document}