
Encontré algo extraño al configurar una tabla larga rotada con apa6
.
Específicamente, esto funciona:
\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}
Insertar una diéresis en una de las celdas de la tabla (primera línea, columna izquierda) rompe todo y produce un error:
\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}
Curiosamente, si elimino \DeclareDelayedFloatFlavor*{landscape}{table}
el preámbulo, todo vuelve a funcionar (sin embargo, necesito conservar este comando).
Por supuesto, el problema se puede solucionar fácilmente escapando de diéresis y caracteres especiales (por ejemplo, \"a
en este caso), pero me preguntaba si existe una solución más general para este contexto.
Gracias de antemano.
PD: las diéresis funcionan correctamente fuera de la mesa larga rotada.
Respuesta1
Por alguna razón que no entiendo, el archivo temporal donde se escribe la tabla retrasada está codificado en latin 1 en lugar de utf8. Por lo tanto, una solución alternativa es establecer la codificación de entrada en latín 1 cuando se vuelve a leer la tabla. Puedes hacer esto cómodamente con
\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}
Respuesta2
Es posible que desee informar al apa6
mantenedor o al endfloat
mantenedor ( apa6
se utiliza endfloat
para mostrar los flotadores).
El problema principal es que si podemos escribir utf8 en el disco, necesitamos que los datos estén protegidos antes de escribirlos; de lo contrario, se expandirán los caracteres especiales.
Esto parece ayudar, colocado en el preámbulo.
\makeatletter
\renewcommand\efloat@iwrite[1]{%
\expandafter\immediate\expandafter\protected@write\csname efloat@post#1\endcsname{}}
\makeatother
Cambié y agregué después porque esta macro espera tres argumentos \write
, no solo dos.\protected@write
{}
\csname
Editar: Hmm, mirando el código generado, no, esto no escribe utf8 en el disco, pero parece compilarse correctamente.