向现有多行元素添加一列

向现有多行元素添加一列

我有以下代码:

主文本:

\documentclass[11pt]{article}
\usepackage{techdoc}
\title{Lorem Ipsum is simply dummy text}
\subtitle{Lorem Ipsum is simply dummy text}
\department{R\&D}
\filepath{//path/to/file}

\begin{document}
\maketitle
\clearpage
\end{document}

techdoc.sty:

\ProvidesPackage{techdoc}

\RequirePackage[a4paper, hmargin=2.5cm, vmargin=1cm, includeheadfoot, headheight=3cm]{geometry}
\RequirePackage{fancyhdr}
\RequirePackage{array}
\RequirePackage{tabularx}
\RequirePackage[table]{xcolor}
\RequirePackage{xspace}
\RequirePackage{lastpage}
\RequirePackage[bookmarks, bookmarksopen,pdfstartview={FitH},colorlinks,linkcolor={black},citecolor={black}, urlcolor={black}]{hyperref}
\RequirePackage{nameref}
\RequirePackage{titlesec}
\RequirePackage{multirow}
\RequirePackage{wrapfig}
\RequirePackage{tikz}
\RequirePackage{tabu}
\RequirePackage{tocvsec2}
\RequirePackage{colortbl}
\RequirePackage[absolute]{textpos}
\RequirePackage{rotating}
\RequirePackage{url}
\RequirePackage[small, labelfont=bf]{caption}
\RequirePackage{calc}
\RequirePackage{makecell}

% fix some bug
\renewcommand{\nobreakspace}{\nobreak\ }

% make foot notes looks nice
\RequirePackage[hang]{footmisc}
\setlength{\footnotemargin}{7pt}

% Document information commands
\newcommand{\@confidentialitynotice}{Internal and Confidential Document}
\newcommand{\confidentialitynotice}[1]{\renewcommand{\@confidentialitynotice}{#1}}
\newcommand{\@subtitle}{}
\newcommand{\subtitle}[1]{\renewcommand{\@subtitle}{#1}}
\newcommand{\@department}{}
\newcommand{\department}[1]{\renewcommand{\@department}{#1}}
\newcommand{\@filepath}{}
\newcommand{\filepath}[1]{\renewcommand{\@filepath}{#1}}
\newcommand{\@version}{}


% Tables
\definecolor{arrayrule}{rgb}{0.5, 0.5, 0.5}
\setlength{\arrayrulewidth}{0.5pt}
\arrayrulecolor{arrayrule}
\newenvironment{nicetable}{\begin{table}[h!t]\renewcommand{\arraystretch}{1.4}\addtolength{\tabcolsep}{3pt}\addtolength{\belowcaptionskip}{4pt}}{\end{table}}
\renewcommand{\arraystretch}{1.4}

% Title page
\setlength{\TPHorizModule}{1cm}
\setlength{\TPVertModule}{1cm}
\renewcommand{\maketitle}{%
    \newgeometry{headheight=0pt, headsep=0pt, hmargin=2.5cm, vmargin=2cm}
    \begin{titlepage}
    \begin{tabularx}{\columnwidth}{|>{\centering\arraybackslash}p{3cm}|>{\centering\arraybackslash}m{\columnwidth-6cm-4\tabcolsep-3\arrayrulewidth}|>{\centering\arraybackslash}p{3cm}|}
        \hline
        \multirow{2}{*}{\includegraphics[width=2.7cm, height=2.0cm]{icon_caution}} & {\bf \@confidentialitynotice } & {\includegraphics[width=2.7cm, height=2.7cm]{icon_goal}} \\[0.3cm] \cline{2-2}
        & \multirow{2}{*}{\bf  \@title}\\[.6cm] \cline{1-1}
        \@department & \\ \hline
    \end{tabularx}


    \vfill

    \begin{center}

    {\Huge \bf \@title}

    \rule{\columnwidth}{2pt}
    \vspace{0.1cm}

    {\LARGE \@subtitle}
    \end{center}

    \vspace{3cm}
    \vfill

    \end{titlepage}
    \setcounter{page}{2} % titlepage messes with my page counter!
    \restoregeometry
}

结果如下:
现有表

我想删除最后一行,而是在右侧创建一个新列,其中只有一个案例,即图标加研发的对称性。

我尝试了以下方法:

\begin{tabularx}{\columnwidth}{|>{\centering\arraybackslash}p{3cm}|>{\centering\arraybackslash}m{\columnwidth-6cm-4\tabcolsep-3\arrayrulewidth}|>{\centering\arraybackslash}p{3cm}|}
    \hline
    \multirow{2}{*}{\includegraphics[width=2.7cm, height=2.0cm]{icon_caution}} & {\bf \@confidentialitynotice } & {\includegraphics[width=2.7cm, height=2.7cm]{icon_goal}} \\[0.3cm] \cline{2-2}
    & \multirow{2}{*}{\bf  \@title}\\[.6cm] \cline{1-1}
    \@department & \\ \hline
\end{tabularx}

结果是:

当前表

我怎样才能改进它并使它看起来更好?

编辑:图标,正如评论中所要求的: 在此处输入图片描述 在此处输入图片描述

答案1

像这样:

在此处输入图片描述

对于上图,我制作了自己的 MWE,因为我对你的 MWE 感到困惑。我相信,你可以轻松地根据自己的需要采用它:

\documentclass{article}
    \usepackage[margin=25mm,showframe]{geometry}
    \usepackage{graphicx}
    \usepackage{multirow,tabularx}

\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
    \begin{document}

{    \renewcommand{\arraystretch}{1.5}
\noindent%
\begin{tabularx}{\textwidth}{|P{3cm}|>{\centering\arraybackslash\bfseries}X|P{3cm}|}
    \hline
\multirow{3}*[2pt]{%
    \includegraphics[width=2.7cm,height=2cm]{example-image-a}}\smallskip~
    &   \rule[-3mm]{0pt}{9mm}
        Internal and Confidential Document\@confidentialitynotice 
        &   \multirow{2}*[2pt]{%
            \includegraphics[width=2.7cm,height=2cm]{example-image-b}}  
                        \\  \cline{2-2}
    &                                       
        &               \\
    &   Lorem Ipsum is simply dummy text%\@title     
        &               \\  \cline{1-1}
R\&D        &       &   \\  \hline
\end{tabularx}
}
    \end{document}

答案2

这是另一个解决方案,代码更简单。我稍微简化了您的包,删除了已被其他包调用的包,例如colortbl由 选项调用table 的包xcolor。此外,最好hyperref在所有其他包之后加载(有一些例外,例如cleveref)。

\ProvidesPackage{techdoc}

\RequirePackage[a4paper, hmargin=2.5cm, vmargin=1cm, includeheadfoot, headheight=3cm]{geometry}
\RequirePackage{fancyhdr}
%\RequirePackage{array}
\RequirePackage{tabularx}
\RequirePackage[table]{xcolor}
\RequirePackage{xspace}
\RequirePackage{lastpage}
\RequirePackage{nameref}
\RequirePackage{titlesec}
\RequirePackage{multirow}
\RequirePackage{wrapfig}
\RequirePackage{tikz}
\RequirePackage{tabu}
\RequirePackage{tocvsec2}
%\RequirePackage{colortbl}
\RequirePackage[absolute]{textpos}
\RequirePackage{rotating}
\RequirePackage{url}
\RequirePackage[small, labelfont=bf]{caption}
\RequirePackage{calc}
\RequirePackage{makecell}
\RequirePackage[bookmarks, bookmarksopen,pdfstartview={FitH},colorlinks,linkcolor={black},citecolor={black},
urlcolor={black}]{hyperref}
\RequirePackage{cellspace}
\setlength\cellspacetoplimit{6pt}
\setlength\cellspacebottomlimit{6pt}
% fix some bug
\renewcommand{\nobreakspace}{\nobreak\ }

% make foot notes looks nice
\RequirePackage[hang]{footmisc}
\setlength{\footnotemargin}{7pt}

% Document information commands
\newcommand{\@confidentialitynotice}{Internal and Confidential Document}
\newcommand{\confidentialitynotice}[1]{\renewcommand{\@confidentialitynotice}{#1}}
\newcommand{\@subtitle}{}
\newcommand{\subtitle}[1]{\renewcommand{\@subtitle}{#1}}
\newcommand{\@department}{}
\newcommand{\department}[1]{\renewcommand{\@department}{#1}}
\newcommand{\@filepath}{}
\newcommand{\filepath}[1]{\renewcommand{\@filepath}{#1}}
\newcommand{\@version}{}


% Tables
\definecolor{arrayrule}{rgb}{0.5, 0.5, 0.5}
\setlength{\arrayrulewidth}{0.5pt}
\arrayrulecolor{arrayrule}
\newenvironment{nicetable}{\begin{table}[h!t]\renewcommand{\arraystretch}{1.4}\addtolength{\tabcolsep}{3pt}\addtolength{\belowcaptionskip}{4pt}}{\end{table}}
\renewcommand{\arraystretch}{1.4}

% Title page
\setlength{\TPHorizModule}{1cm}
\setlength{\TPVertModule}{1cm}

\renewcommand{\maketitle}{%
    \newgeometry{headheight=0pt, headsep=0pt, hmargin=2.5cm, vmargin=2cm}
    \sffamily
    \begin{titlepage}
       \centering\large
     \begin{tabularx}{\columnwidth}{|>{\centering\arraybackslash}Sc|@{}>{\centering\arraybackslash}X%
 @{}|>{\centering\arraybackslash}Sc|}
        \hline
       \raisebox{-0.6\height}{\includegraphics[width=2.7cm]{icon_caution}} &% \multirow{2}{*}{%
       \parbox{\linewidth}{\centering\bfseries\@confidentialitynotice\\[0.6cm]
       \hrule\vskip0.5cm\Large\@title}%}
        & \raisebox{-0.6\height}{\includegraphics[width=2.7cm]{icon_goal}}  \\
        \cline{1-1}\cline{3-3}
       \textit{\bfseries \@department}  &  &  \\
       \hline
    \end{tabularx}


    \vfill

    \begin{center}

    {\Huge \bfseries \@title}

    \rule{\columnwidth}{2pt}
    \vspace{0.1cm}

    {\LARGE \@subtitle}
    \end{center}

    \vspace{3cm}
    \vfill

    \end{titlepage}
    \setcounter{page}{2} % titlepage messes with my page counter!
    \restoregeometry
}

主文件:我加载了lmodern,而不是默认的cm,以便拥有斜体粗体无字体。

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{techdoc}
\title{Lorem Ipsum is simply dummy text}
\subtitle{Lorem Ipsum is simply dummy text}
\department{R\,\&\,D}
\filepath{//path/to/file}

\begin{document}
\maketitle
\clearpage
\end{document} 

在此处输入图片描述

相关内容