需要桌子微调帮助

需要桌子微调帮助

首先,代码如下,

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper, top=0.2in, bottom=0.15in, left=0.25in, right=0.25in]{geometry}
\usepackage{multirow,array,varwidth,spreadtab,caption}
\usepackage{booktabs}
\usepackage{siunitx,booktabs,caption}
\usepackage{multirow,array,varwidth,spreadtab,}
\usepackage{siunitx,booktabs,caption}
\usepackage{ragged2e}
\usepackage{layout}
\usepackage{float}
\restylefloat{table}
\newcolumntype{L}[1]{>{\RaggedRight\hspace{0pt}}p{#1}}
\newcolumntype{R}[1]{>{\RaggedLeft\hspace{0pt}}p{#1}}
\usepackage[scaled]{helvet}
\renewcommand\familydefault{\sfdefault} 
\usepackage[T1]{fontenc}
\usepackage{pythontex}

\begin{document}
\noindent
\begin{minipage}[t]{.11\textwidth}
\raggedright
\raggedleft
\scriptsize
\begin{tabular}[t]{@{} r l @{}}% <-- Don't forget @{}!
\textbf{COMPANY:}&{ffffff}\\ %%enter value in the space after "&"
\textbf{FACTORY:}&\\
\textbf{FIELD:}&  \\%%enter value in the space after "&"
\textbf{LEASE:}&  fadsfasdfasd  \\%%enter value in the space after "&"
\end{tabular}
\end{minipage}% <-- Don't forget this one
%
\hfill
%
 \begin{minipage}[c]{.735\textwidth}
  \small
    \centering
  \textbf{PETROBRA COMPANY LIMITED} \\
  \textbf{THE ESTIMATE OF RESERVES AND FUTURE INCOME ATTRIBUTABLE} \\
  \textbf{TO CERTAIN INTERESTS} \\
  \textbf{As of JAN 1 2017}}
\end{minipage}
%
\hfill
%
\begin{minipage}[t]{.135\textwidth}
\raggedleft
\scriptsize
\begin{tabular}[t]{@{} r l @{}}% <-- Don't forget @{}!
\textbf{ID:} &         gsfd  \\ %%enter value in the space after "&"
\textbf{MAJOR PHASE:} & Oil \\%%enter value in the space after "&"
\textbf{AAAA Reserves:} & gfdsgsd \\%%enter value in the space after "&"
\textbf{Dev.Status:} &     gsdf\\%%enter value in the space after "&"
\end{tabular}
\end{minipage}
\end{document}

我想做的是,

  1. 尽量减少或缩小“公司“和“ffffff”调整;

  2. 右侧迷你页面位置,使其足够靠左以允许较长 ID现存的;

  3. 确保迷你页面中间居中。

在此处输入图片描述

PS 即使我在表格环境中添加了@{},也无济于事。

答案1

看看这是否与您想要实现的布局类似:

在此处输入图片描述

\documentclass{article}
\usepackage[a4paper, top=0.2in, bottom=0.15in, 
            left=0.25in, right=0.25in,
            ]{geometry}
    \usepackage{array}
    \usepackage{calc}% <-- added

\begin{document}
\setlength\tabcolsep{2pt}
\noindent\begin{tabular}{|@{}
        >{\scriptsize}m{0.2\textwidth-1\tabcolsep}|
        >{\centering\bfseries}m{.6\textwidth-4\tabcolsep}|
        >{\raggedleft\scriptsize}m{.2\textwidth-\tabcolsep}|
                   @{}|}
\begin{tabular}[t]{@{}>{\bfseries}rl}% <-- Don't forget @{}!
COMPANY:  & ffffff          \\ %%enter value in the space after "&"
FACTORY:  &                 \\
FIELD:    &                 \\%%enter value in the space after "&"
LEASE:    & fadsfasdfasd    \\%%enter value in the space after "&"
\end{tabular}
%
&
%
PETROBRA COMPANY LIMITED 

THE ESTIMATE OF RESERVES AND FUTURE INCOME ATTRIBUTABLE %

TO CERTAIN INTERESTS 

As of JAN 1 2017
%
&
%
\begin{tabular}[t]{>{\bfseries}rl@{}}% <-- Don't forget @{}!
ID:             & gsfd      \\%%enter value in the space after "&"
MAJOR PHASE:    & Oil       \\%%enter value in the space after "&"
AAAA Reserves:  & gfdsgsd   \\%%enter value in the space after "&"
Dev.Status:     & gsdf      \\%%enter value in the space after "&"
\end{tabular}
    \end{tabular}
\end{document}

垂直线仅用于定位。最后必须将其省略。如您所见,我没有使用 minipages。而是使用\tabular在第一列和最后一列中嵌套表格。为了确定它们的列宽,我添加了包calc。此外,我将粗体字体命令移至列类型选项。

附录: 您可能希望嵌套(子)表中的文本在相同位置使用粗体文本,而不管文本宽度如何。在这种情况下,最好使用第二列而不是列类型l˙p{} where you deliberately select width. For examplep{12ex}` 作为右子表,这似乎是不错的选择。尝试使用您的实际单元格内容并查看是否可行。

警告:由于子表具有列类型rl,因此可能会发生这种情况,如果单元格中的文本长于主表中的保留宽度,则它们将突出于主表列宽之外。

附录(2):如果您希望所有单元格的内容与其底部对齐,则只需将列类型从m更改为b并将子表位置从t更改为 即可b。在这种情况下,通过稍微重新格式化主标题布局,您可以获得:

在此处输入图片描述

\noindent\begin{tabular}{@{}
        >{\scriptsize}b{0.2\textwidth-1\tabcolsep}
        >{\centering\bfseries}b{.6\textwidth-4\tabcolsep}
        >{\raggedleft\scriptsize}b{.2\textwidth-\tabcolsep}
                   @{}}
\begin{tabular}[b]{@{}>{\bfseries}rl}% <-- Don't forget @{}!
COMPANY:  & ffffff          \\ %%enter value in the space after "&"
FACTORY:  &                 \\ %%enter value in the space after "&"
FIELD:    &                 \\ %%enter value in the space after "&"
LEASE:    & fadsfasdfasd    \\ %%enter value in the space after "&"
\end{tabular}
    &
PETROBRA COMPANY LIMITED
THE ESTIMATE OF RESERVES AND FUTURE INCOME ATTRIBUTABLE TO CERTAIN INTERESTS

As of JAN 1 2017
        &
\begin{tabular}[b]{>{\bfseries}rl@{}}% <-- Don't forget @{}!
ID:             & gsfd      \\%%enter value in the space after "&"
MAJOR PHASE:    & Oil       \\%%enter value in the space after "&"
AAAA Reserves:  & gfdsgsd   \\%%enter value in the space after "&"
Dev.Status:     & gsdf      \\%%enter value in the space after "&"
\end{tabular}
    \end{tabular}

对于顶部位置,您需要更改mp并将子表位置更改为t

在此处输入图片描述

\noindent\begin{tabular}{@{}
        >{\scriptsize}p{0.2\textwidth-1\tabcolsep}
        >{\centering\bfseries}p{.6\textwidth-4\tabcolsep}
        >{\raggedleft\scriptsize}p{.2\textwidth-\tabcolsep}
                   @{}}
\begin{tabular}[t]{@{}>{\bfseries}rl}% <-- Don't forget @{}!
COMPANY:  & ffffff          \\ %%enter value in the space after "&"
FACTORY:  &                 \\ %%enter value in the space after "&"
FIELD:    &                 \\ %%enter value in the space after "&"
LEASE:    & fadsfasdfasd    \\ %%enter value in the space after "&"
\end{tabular}
    &
PETROBRA COMPANY LIMITED
THE ESTIMATE OF RESERVES AND FUTURE INCOME ATTRIBUTABLE TO CERTAIN INTERESTS

As of JAN 1 2017
        &
\begin{tabular}[t]{>{\bfseries}rl@{}}% <-- Don't forget @{}!
ID:             & gsfd      \\%%enter value in the space after "&"
MAJOR PHASE:    & Oil       \\%%enter value in the space after "&"
AAAA Reserves:  & gfdsgsd   \\%%enter value in the space after "&"
Dev.Status:     & gsdf      \\%%enter value in the space after "&"
\end{tabular}
    \end{tabular}

相关内容