问题

问题

这是另一项后续行动这个问题

我当前的\blap宏在tabularxX 列中与article类一起工作。但它与memoir类的行为略有不同。具体来说,在这种情况下, 的垂直校正\vspace*{-\parskip}\vspace*{-\baselineskip}似乎不需要memoir。(在 中的表格之外的其他上下文中仍然需要此垂直校正memoir,因此我无法完全摆脱它。)

memoir模拟tabularx,但使用它的方法来使用真实的tabularx包并没有什么区别。即,这没有任何区别:

\DisemulatePackage{tabularx}
\usepackage{tabularx}

问题

有人能提出解决办法吗?

我很高兴能找到一种解决方法、一种补丁memoir或一种强大的方法来测试我是否在 X 列单元格中,这样我就可以有条件地省略\vspace*{-\parskip}\vspace*{-\baselineskip}

平均能量损失

\documentclass[twocolumn]{memoir}% works as intended with article
\usepackage{ifluatex}
\ifluatex
  \usepackage{lua-visual-debug}
\fi
\usepackage{tabularx}
\newskip\savedparindent
\newskip\savedparskip
\newskip\savedrightskip
\newcommand{\blap}[1]{%
  \savedparindent\parindent
  \savedparskip\parskip
  \savedrightskip\rightskip
  \noindent
  \begin{minipage}[t][0pt]{\linewidth}
    \parindent\savedparindent
    \parskip\savedparskip
    \rightskip\savedrightskip
    #1%
  \end{minipage}%
  % The following line is generally needed to line things up
  % but not in X columns in memoir (article is OK)
  \vspace*{-\parskip}\vspace*{-\baselineskip}%
}
\pagestyle{empty}
\begin{document}
\noindent
\begin{tabularx}{\linewidth}{lX}
  A1 & \blap{B1} \\[1cm]
  A2 & A2 \\[1cm]
\end{tabularx}
\newpage
\noindent
\begin{tabularx}{\linewidth}{lX}
  A1 & B1 \\[1cm]
  A2 & A2 \\[1cm]
\end{tabularx}
\end{document}

答案1

太长了,无法评论。在我真正从 中删除array和之前,这似乎在 TL18 上有效。tabularxmemoir

\documentclass[twocolumn]{memoir}% works as intended with article
\usepackage{ifluatex}
\ifluatex
  \usepackage{lua-visual-debug}
\fi

\DisemulatePackage{array}
\DisemulatePackage{tabularx}
\let\extratabsurround\relax
\makeatletter
\let\backup@length\relax
\let\firsthline\relax
\let\lasthline\relax
\def\@xhline{\ifx\reserved@a\hline
               \vskip\doublerulesep
               \vskip-\arrayrulewidth
             \fi
      \ifnum0=`{\fi}}
\newcommand\undefcolumntype[1]{\expandafter\let\csname NC@find@#1\endcsname\relax}
\newcommand\forcenewcolumntype[1]{\undefcolumntype{#1}\newcolumntype{#1}}
\undefcolumntype{X}
\undefcolumntype{*}
\makeatother
\usepackage{array,tabularx}

\newskip\savedparindent
\newskip\savedparskip
\newskip\savedrightskip
\newcommand{\blap}[1]{%
  \savedparindent\parindent
  \savedparskip\parskip
  \savedrightskip\rightskip
  \noindent
  \begin{minipage}[t][0pt]{\linewidth}
    \parindent\savedparindent
    \parskip\savedparskip
    \rightskip\savedrightskip
    #1%
  \end{minipage}%
  % The following line is generally needed to line things up
  % but not in X columns in memoir (article is OK)
  \vspace*{-\parskip}\vspace*{-\baselineskip}%
}
\pagestyle{empty}
\begin{document}
\noindent
\begin{tabularx}{\linewidth}{lX}
  A1 & \blap{B1} \\[1cm]
  A2 & A2 \\[1cm]
\end{tabularx}
\newpage
\noindent
\begin{tabularx}{\linewidth}{lX}
  A1 & B1 \\[1cm]
  A2 & A2 \\[1cm]
\end{tabularx}
\end{document}

我只是不断放松,直到它不再抱怨。删除已定义列类型的代码来自此处:https://tex.stackexchange.com/a/157062/3929

相关内容