我刚刚发现使用tabularx
会破坏表格的正常编号(请参见图片)。根据特克斯链接这可能是由于\caption
命令超出了tabularx
环境范围。但是,当我纠正这个问题时,我在编译时收到错误消息。
有人可以给出建议吗?
梅威瑟:
\documentclass[a4paper,12pt]{article}
\usepackage{graphicx}
\usepackage[main=british]{babel}
%\usepackage{gensymb}
\usepackage[section]{placeins}%Allows you to permanently fix figures.
\usepackage[left=2.5cm, right=2.5cm, top=3.5cm, bottom=3.5cm]{geometry}%this changes the page geometry i.e. margins left, right, top and bottom
%\usepackage{caption}
\usepackage{mathptmx}
%\usepackage{newtxmath}
\usepackage{titleps,microtype,setspace,amsmath,SIunits,tabularx}
\usepackage{booktabs,caption, makecell,ltablex}
\usepackage{pdflscape,afterpage}
\usepackage[backend=bibtex, citestyle=ieee, bibstyle=ieee]{biblatex}
\addbibresource{library}
\onehalfspacing
\renewcommand\theadfont{\small\bfseries}
\renewcommand\tabularxcolumn[1]{m{#1}}
\usepackage[usestackEOL]{stackengine}
\usepackage[table]{xcolor}
\usepackage{enumitem}
\usepackage{etoolbox}
\AtBeginEnvironment{table}{%
\setlist[enumerate]{nosep,
topsep = 0pt,
partopsep = 0pt,
leftmargin = *,
before = \vspace{-0.6\baselineskip},
after = \vspace{-\baselineskip}
}}
\keepXColumns
\begin{document}
\begin{table}[ht]
\caption{Cognitive walkthrough goals, tasks and actions}
\label{table:comparison of techniques}
\small
\begin{tabularx}{\linewidth}{@{}
X
>{\centering\arraybackslash}X % content of `X` column is now centered
X
@{}}
\toprule
\thead{\textbf{Goal}}& \thead{\textbf{Task}} & \thead{\textbf{Action}} \\
\midrule
Evaluate the ease in which users can join projects
& Task 1: Access and account set up
& \begin{enumerate}
\item Text.
Text.
\item Join the project.
\end{enumerate} \\
\addlinespace
Evaluate the ease in learning to map
& Task 2: Learning how to map
& Read tutorial \\
\addlinespace
Contribute data
& Task 3: Contributing data by classifying maps
& \begin{enumerate}
\item Begin mapping.
\item Text.
Text.
\item Review maps classified.
\end{enumerate} \\
\addlinespace
Evaluate if the user likes using the application and whether they like using it
& -- & -- \\
\bottomrule
\vspace{-18mm}%needed otherwise the table gets lost between pagebreaks.
\end{tabularx}
\end{table}
\begin{table}[ht]
\caption{Cognitive walkthrough - evaluation questions}
\setlength\tabcolsep{3pt}
\centering
\small
\hspace*{-18mm}%
\begin{tabular}{ p{30mm} p{80mm} }
\toprule
Question & Description \\ [0.5ex]
\midrule
1 & Is the effect of the current action the same as the user's goals \\
2 & Is the action visible? \\
3 & Will the user recognise the action as the right one? \\
4 & Will the user understand the feedback? \\
\bottomrule
\end{tabular}%
\hspace*{-12mm}%
\end{table}
\end{document}
图片 - 表格编号错误
提前致谢!
答案1
这是一种即使在特定上下文中(例如在某个环境中)也没有意义ltablex
的特征。tabularx
longtable
longtable
table
对于发布的示例,您可以简单地使用
\usepackage{tabularx}
代替
\usepackage{ltablex}
但是如果您ltablex
出于其他原因需要在实际文档中这样做,那么将表计数器放回原位\caption
以便tabularx
/longtable
将其增加到正确值是足够安全的:
\caption{Cognitive walkthrough goals, tasks and actions}
\label{table:comparison of techniques}
\addtocounter{table}{-1}%<<<<<<
\small
\begin{tabularx}{\linewidth}{@{}