旋转长表中的变音符号问题

旋转长表中的变音符号问题

我在用 设置旋转长表时遇到了一件奇怪的事情apa6

具体来说,这是有效的:

\documentclass[12pt
               ,man % manuscript mode; jou man doc
               ,babel, american % language
               %,biblatex % loads biblatex or apacite
               ,a4paper % default:letter
               % ,floatsintext
               ,noextraspace %removes extra space after headings; closer to "true" double-spacing
               %,mask
               ,longtable
               %,helv % font in man mode
               %,tt   % font in man mode
               %,draftfirst
               %,draftall
               ]{apa6}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{lipsum}
\usepackage{threeparttablex}
\usepackage{siunitx}


%% for the huge table to avoid boxes warnings
\newcommand{\rr}{\raggedright}
\newcommand{\tn}{\tabularnewline}


\DeclareDelayedFloatFlavor*{landscape}{table}


\title{Longtables and Me: An Endless Story}
\shorttitle{Longtables}

\author{Me}
\affiliation{MeU}

\authornote{
Empty
}



\abstract{
Empty.
}


\keywords{Empty}





\begin{document}

\lipsum

\begin{landscape}

\begin{ThreePartTable}

\begin{TableNotes}
\rr \footnotesize %
\textit{Note.} 
Just a TableNote to explain some stuff.
\end{TableNotes}


\begin{longtable}{p{7.3cm}
                  S[table-format = 5]
                  l
                  l
                  S[table-format = 2.2]
                  c
                  p{5cm}}

\caption{Longitudinal Studies Included in the Analysis} \\
\label{tab:studies} \\

\toprule
1st Column  & {2nd Column}  &  3rd Column   &  4th Column  &  {5th Column}  &  6th  &  7th Column\\
\midrule
\endfirsthead


\multicolumn{7}{l}{{\tablename} \thetable{} (continued)} \\[0.5ex]

\toprule
1st Column  & {2nd Column}  &  3rd Column   &  4th Column  &  {5th Column}  &  6th  &  7th Column\\
\midrule
\endhead

\rr An Entry    & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry that is quite long and breaks to the next line   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr Another rather long Entry that also breaks and extends over two lines   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\


\bottomrule

\insertTableNotes

\end{longtable}

\end{ThreePartTable}
\end{landscape}


\lipsum


\end{document}

在表格单元格之一(第一行,左列)中插入变音符号会破坏所有内容并产生错误:

\documentclass[12pt
               ,man % manuscript mode; jou man doc
               ,babel, american % language
               %,biblatex % loads biblatex or apacite
               ,a4paper % default:letter
               % ,floatsintext
               ,noextraspace %removes extra space after headings; closer to "true" double-spacing
               %,mask
               ,longtable
               %,helv % font in man mode
               %,tt   % font in man mode
               %,draftfirst
               %,draftall
               ]{apa6}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{lipsum}
\usepackage{threeparttablex}
\usepackage{siunitx}


%% for the huge table to avoid boxes warnings
\newcommand{\rr}{\raggedright}
\newcommand{\tn}{\tabularnewline}


\DeclareDelayedFloatFlavor*{landscape}{table}


\title{Longtables and Me: An Endless Story}
\shorttitle{Longtables}

\author{Me}
\affiliation{MeU}

\authornote{
Empty
}



\abstract{
Empty.
}


\keywords{Empty}





\begin{document}

\lipsum

\begin{landscape}

\begin{ThreePartTable}

\begin{TableNotes}
\rr \footnotesize %
\textit{Note.} 
Just a TableNote to explain some stuff.
\end{TableNotes}


\begin{longtable}{p{7.3cm}
                  S[table-format = 5]
                  l
                  l
                  S[table-format = 2.2]
                  c
                  p{5cm}}

\caption{Longitudinal Studies Included in the Analysis} \\
\label{tab:studies} \\

\toprule
1st Column  & {2nd Column}  &  3rd Column   &  4th Column  &  {5th Column}  &  6th  &  7th Column\\
\midrule
\endfirsthead


\multicolumn{7}{l}{{\tablename} \thetable{} (continued)} \\[0.5ex]

\toprule
1st Column  & {2nd Column}  &  3rd Column   &  4th Column  &  {5th Column}  &  6th  &  7th Column\\
\midrule
\endhead

\rr An Entry with ä    & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry that is quite long and breaks to the next line   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr Another rather long Entry that also breaks and extends over two lines   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\


\bottomrule

\insertTableNotes

\end{longtable}

\end{ThreePartTable}
\end{landscape}


\lipsum


\end{document}

有趣的是,如果我\DeclareDelayedFloatFlavor*{landscape}{table}从序言中删除,一切都会再次正常工作(但是,我需要保留这个命令)。

当然,可以通过转义变音符号和特殊字符(例如,\"a在这种情况下)轻松规避该问题,但我想知道是否存在针对这种情况的更通用的解决方案。

提前致谢。

PS:变音符号在旋转的长表之外正常工作。

答案1

由于某些我不明白的原因,延迟表写入的临时文件采用 latin 1 而不是 utf8 编码。因此,一种解决方法是在再次读入表时将输入编码设置为 latin 1。您可以方便地使用以下命令执行此操作

\AtBeginDelayedFloats{\inputencoding{latin1}}

示例输出

\documentclass[12pt
               ,man % manuscript mode; jou man doc
               ,babel, american % language
               %,biblatex % loads biblatex or apacite
               ,a4paper % default:letter
               % ,floatsintext
               ,noextraspace %removes extra space after headings; closer to "true" double-spacing
               %,mask
               ,longtable
               %,helv % font in man mode
               %,tt   % font in man mode
               %,draftfirst
               %,draftall
               ]{apa6}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{lipsum}
\usepackage{threeparttablex}
\usepackage{siunitx}


%% for the huge table to avoid boxes warnings
\newcommand{\rr}{\raggedright}
\newcommand{\tn}{\tabularnewline}


\DeclareDelayedFloatFlavor*{landscape}{table}
\AtBeginDelayedFloats{\inputencoding{latin1}}

\title{Longtables and Me: An Endless Story}
\shorttitle{Longtables}

\author{Me}
\affiliation{MeU}

\authornote{
Empty
}



\abstract{
Empty.
}


\keywords{Empty}





\begin{document}

\lipsum

\begin{landscape}

\begin{ThreePartTable}

\begin{TableNotes}
\rr \footnotesize %
\textit{Note.}
Just a TableNote to explain some stuff.
\end{TableNotes}


\begin{longtable}{p{7.3cm}
                  S[table-format = 5]
                  l
                  l
                  S[table-format = 2.2]
                  c
                  p{5cm}}

\caption{Longitudinal Studies Included in the Analysis} \\
\label{tab:studies} \\

\toprule
1st Column  & {2nd Column}  &  3rd Column   &  4th Column  &  {5th Column}  &  6th  &  7th Column\\
\midrule
\endfirsthead


\multicolumn{7}{l}{{\tablename} \thetable{} (continued)} \\[0.5ex]

\toprule
1st Column  & {2nd Column}  &  3rd Column   &  4th Column  &  {5th Column}  &  6th  &  7th Column\\
\midrule
\endhead

\rr An Entry with ä    & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry that is quite long and breaks to the next line   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr Another rather long Entry that also breaks and extends over two lines   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\

\rr An Entry   & 1234  & ABCD    & glo  & 99.32  & 2  & Some more text \\


\bottomrule

\insertTableNotes

\end{longtable}

\end{ThreePartTable}
\end{landscape}


\lipsum


\end{document}

答案2

您可能想要通知apa6维护者或者endfloat维护者(apa6用于endfloat取消显示浮点数)。

主要问题是,如果我们可以将 utf8 写入磁盘,我们需要在写入之前保护数据,否则特殊字符会被扩展。

这似乎有帮助,放在序言中

\makeatletter
\renewcommand\efloat@iwrite[1]{%
   \expandafter\immediate\expandafter\protected@write\csname efloat@post#1\endcsname{}}

\makeatother

我将\write其改为\protected@write并添加了{}之后,\csname因为这个宏需要三个参数而不仅仅是两个。

编辑:嗯,查看生成的代码,不,这不会将 utf8 写入磁盘,但它似乎可以正确编译。

相关内容