![我的表格右边距显示“x”](https://linux22.com/image/450663/%E6%88%91%E7%9A%84%E8%A1%A8%E6%A0%BC%E5%8F%B3%E8%BE%B9%E8%B7%9D%E6%98%BE%E7%A4%BA%E2%80%9Cx%E2%80%9D.png)
我的两个表格都出现过两次这个问题。在右边距旁边,我看到一个奇怪的“x”,我不知道它从何而来。我想这个错误出现的原因可能很明显。我已经从 excel2latex 转换了这个表格并做了一些编辑,但其中应该没有 x。
它看起来是这样的。这是我的代码
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{placeins}
\usepackage{float}
\usepackage{amsmath }
\usepackage{graphicx}
\graphicspath{ {images/} }
%%%\usepackage{lscape} % don't load both lscape and pdflscape
\usepackage{pdflscape}
\usepackage{fancyhdr}
\usepackage[paper=portrait,pagesize]{typearea}
\usepackage{natbib}
\bibliographystyle{agsm}
\usepackage{longtable}
\newcommand{\etal}{\textit{et al.}}
\usepackage{amssymb}
\usepackage{array}
\setlength\extrarowheight{2pt}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{calc}% http://ctan.org/pkg/calc
%%\usepackage{amsfonts} % 'amsfonts' is loaded automatically by 'amssymb'
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\usepackage{hyperref} % it's a good idea to load this package _last_
\hypersetup{
pdftoolbar=true, % show Acrobat’s toolbar?
pdfmenubar=true, % show Acrobat’s menu?
pdffitwindow=false, % window fit to page when opened
pdfstartview={FitH}, % fits the width of the page to the window
pdftitle={title}, % title
pdfauthor={Salvatore Mazzarino}, % author
pdfsubject={Subject}, % subject of the document
pdfcreator={Salvatore Mazzarino}, % creator of the document
pdfproducer={Salvatore Mazzarino}, % producer of the document
pdfkeywords={Green Networking} {Mobile Cloud} {Network Coding} {Energy}, % list of keywords
pdfnewwindow=true, % links in new window
colorlinks=true, % false: boxed links; true: colored links
linkcolor=blue, % color of internal links (change box color with linkbordercolor)
citecolor=blue, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=cyan % color of external links
}
\begin{document}
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
\centering
\caption{Sensitivity checks table}
\begin{tabular}{rrrrrrrr}
\toprule
& \multicolumn{3}{c}{\textbf{2018}} & & \multicolumn{3}{c}{\textbf{2017}} \\
\midrule
\multicolumn{1}{p{4.055em}}{\textbf{Model}} & \multicolumn{1}{p{4.055em}}{a} & \multicolumn{1}{p{4.055em}}{b} & \multicolumn{1}{p{4.055em}}{c} & \multicolumn{1}{p{4.055em}}{d} & \multicolumn{1}{p{4.055em}}{a} & \multicolumn{1}{p{4.055em}}{b} & \multicolumn{1}{p{4.055em}}{c} \\
\midrule
\multicolumn{1}{p{4.055em}}{\textbf{Wealth }} & \multicolumn{1}{p{4.055em}}{No} & \multicolumn{1}{p{4.055em}}{ (Yes)} & \multicolumn{1}{p{4.055em}}{(Yes incl. vehicles)} & \multicolumn{1}{p{4.055em}}{(Yes incl. vehicles)} & \multicolumn{1}{p{4.055em}}{No} & \multicolumn{1}{p{4.055em}}{ (Yes)} & \multicolumn{1}{p{4.055em}}{(Yes* incl. vehicles)} \\
\midrule
\multicolumn{1}{p{4.055em}}{\textbf{Housing costs}} & \multicolumn{1}{p{4.055em}}{No cap} & \multicolumn{1}{p{4.055em}}{No cap} & \multicolumn{1}{p{4.055em}}{No cap} & \multicolumn{1}{p{4.055em}}{Imputed for INR} & \multicolumn{1}{p{4.055em}}{No cap} & \multicolumn{1}{p{4.055em}}{No cap} & \multicolumn{1}{p{4.055em}}{No cap} \\
\multicolumn{1}{l}{\multirow{\textbf{NTR}}} & \multicolumn{1}{c}{\multirow{\textbf{52.06}}} & \multicolumn{1}{r}{\multirow{\textbf{43.09}}} & \multicolumn{1}{c}{\multirow{\textbf{42.01}}} & \multicolumn{1}{c}{\multirow{\textbf{42.25}}} & \multicolumn{1}{c}{\multirow{\textbf{50.35}}} & \multicolumn{1}{c}{\multirow{\textbf{40.42}}} & \multicolumn{1}{c}{\multirow{\textbf{38.62}}} \\
& & & & & & & \\
\multicolumn{1}{l}{\multirow{\textbf{NTR }}} & \multicolumn{1}{c}{\multirow{\textbf{46.26}}} & \multicolumn{1}{c}{\multirow{\textbf{36.45}}} & \multicolumn{1}{c}{\multirow{\textbf{35.16}}} & \multicolumn{1}{c}{\multirow{\textbf{35.48}}} & \multicolumn{1}{c}{\multirow{\textbf{43.87}}} & \multicolumn{1}{c}{\multirow{\textbf{33.12}}} & \multicolumn{1}{c}{\multirow{\textbf{31.24}}} \\
& & & & & & & \\
\multicolumn{1}{p{4.055em}}{\textbf{Beta-error rate}} & \multicolumn{1}{c}{\multirow{\textbf{12.52}}} & \multicolumn{1}{c}{\multirow{\textbf{18.22}}} & \multicolumn{1}{c}{\multirow{\textbf{19.49}}} & \multicolumn{1}{c}{\multirow{\textbf{19.09}}} & \multicolumn{1}{c}{\multirow{\textbf{14.77}}} & \multicolumn{1}{c}{\multirow{\textbf{22.04}}} & \multicolumn{1}{c}{\multirow{\textbf{23.61}}} \\
& & & & & & & \\
\midrule
& \multicolumn{2}{p{8.11em}}{\textbf{Needs}} & & \multicolumn{2}{p{8.11em}}{\textbf{Income}} & \multicolumn{2}{p{8.11em}}{\textbf{Housing}} \\
\midrule
\multicolumn{1}{p{4.055em}}{\textbf{∆}} & \multicolumn{1}{p{4.055em}}{\textbf{↑ +5\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↓ -5\%}} & & \multicolumn{1}{p{4.055em}}{\textbf{↑ +5\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↓ -5\% }} & \multicolumn{1}{p{4.055em}}{\textbf{↑ +5\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↓ -5\%}} \\
\midrule
\multicolumn{1}{p{4.055em}}{\textbf{NTR}} & \multicolumn{1}{p{4.055em}}{\textbf{43.32}} & \multicolumn{1}{p{4.055em}}{\textbf{41.16}} & & \multicolumn{1}{p{4.055em}}{\textbf{41.01}} & \multicolumn{1}{p{4.055em}}{\textbf{43.75}} & \multicolumn{1}{p{4.055em}}{\textbf{42.4}} & \multicolumn{1}{p{4.055em}}{\textbf{41.92}} \\
\multicolumn{1}{p{4.055em}}{\textbf{Beta-error rate}} & \multicolumn{1}{l}{\multirow{\textbf{17.92}}} & \multicolumn{1}{l}{\multirow{\textbf{21.44}}} & & \multicolumn{1}{l}{\multirow{\textbf{20.45}}} & \multicolumn{1}{l}{\multirow{\textbf{18.56}}} & \multicolumn{1}{l}{\multirow{\textbf{19.25}}} & \multicolumn{1}{l}{\multirow{\textbf{19.89}}} \\
& & & & & & & \\
\multicolumn{1}{p{4.055em}}{\textbf{∆}} & \multicolumn{1}{p{4.055em}}{\textbf{↑+10\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↓ -10\%}} & & \multicolumn{1}{p{4.055em}}{\textbf{↑ +10\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↓ -10\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↑+10\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↓ -10\%}} \\
\multicolumn{1}{p{4.055em}}{\textbf{NTR}} & \multicolumn{1}{p{4.055em}}{\textbf{44.99}} & \multicolumn{1}{p{4.055em}}{\textbf{39.81}} & & \multicolumn{1}{p{4.055em}}{\textbf{39.5}} & \multicolumn{1}{p{4.055em}}{\textbf{45.6}} & \multicolumn{1}{p{4.055em}}{\textbf{42.94}} & \multicolumn{1}{p{4.055em}}{\textbf{42.04}} \\
\multicolumn{1}{p{4.055em}}{\textbf{Beta-error rate}} & \multicolumn{1}{p{4.055em}}{\textbf{16.16}} & \multicolumn{1}{p{4.055em}}{\textbf{23.42}} & & \multicolumn{1}{c}{\textbf{21.03}} & \multicolumn{1}{c}{\textbf{17.8}} & \multicolumn{1}{p{4.055em}}{\textbf{19.35}} & \multicolumn{1}{p{4.055em}}{\textbf{20.54}} \\
\midrule
& & & & & & & \\
\end{tabular}%
\label{tab:addlabel}%
{\raggedright \*{*All specifications listed here are for the month of interview and core family or referring to (HH). NTR refers to caseloads. Sensitivity checks are done for model (c). Denominator incl. Beta-error. \par}
\end{table}%
\end{document}
谢谢。
答案1
您看到的时间符号是由命令\*
在代码末尾插入的,位于tabular
环境结束后。如果您不知道此命令,请参阅这个问题。
我修改了你的代码以使其可编译:
- 我删除了这些
\multirow
命令,因为它们似乎没有存在的理由; - 我将 unicode 字符“∆”声明为
\DeclareUnicodeCharacter{2206}{\(\Delta\)}
}
我在表格末尾添加了缺失值。
\*
然后我通过跳过表格环境后的一行删除了添加的时间符号。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{placeins}
\usepackage{float}
\usepackage{amsmath }
\usepackage{graphicx}
\graphicspath{ {images/} }
%%%\usepackage{lscape} % don't load both lscape and pdflscape
\usepackage{pdflscape}
\usepackage{fancyhdr}
\usepackage[paper=portrait,pagesize]{typearea}
\usepackage{natbib}
\bibliographystyle{agsm}
\usepackage{longtable}
\newcommand{\etal}{\textit{et al.}}
\usepackage{amssymb}
\usepackage{array}
\setlength\extrarowheight{2pt}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{calc}% http://ctan.org/pkg/calc
%%\usepackage{amsfonts} % 'amsfonts' is loaded automatically by 'amssymb'
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\usepackage{hyperref} % it's a good idea to load this package _last_
\hypersetup{
pdftoolbar=true, % show Acrobat’s toolbar?
pdfmenubar=true, % show Acrobat’s menu?
pdffitwindow=false, % window fit to page when opened
pdfstartview={FitH}, % fits the width of the page to the window
pdftitle={title}, % title
pdfauthor={Salvatore Mazzarino}, % author
pdfsubject={Subject}, % subject of the document
pdfcreator={Salvatore Mazzarino}, % creator of the document
pdfproducer={Salvatore Mazzarino}, % producer of the document
pdfkeywords={Green Networking} {Mobile Cloud} {Network Coding} {Energy}, % list of keywords
pdfnewwindow=true, % links in new window
colorlinks=true, % false: boxed links; true: colored links
linkcolor=blue, % color of internal links (change box color with linkbordercolor)
citecolor=blue, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=cyan % color of external links
}
\DeclareUnicodeCharacter{2206}{\(\Delta\)}
\begin{document}
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
\centering
\caption{Sensitivity checks table}
\begin{tabular}{rrrrrrrr}
\toprule
& \multicolumn{3}{c}{\textbf{2018}} & & \multicolumn{3}{c}{\textbf{2017}} \\
\midrule
\multicolumn{1}{p{4.055em}}{\textbf{Model}} & \multicolumn{1}{p{4.055em}}{a} & \multicolumn{1}{p{4.055em}}{b} & \multicolumn{1}{p{4.055em}}{c} & \multicolumn{1}{p{4.055em}}{d} & \multicolumn{1}{p{4.055em}}{a} & \multicolumn{1}{p{4.055em}}{b} & \multicolumn{1}{p{4.055em}}{c} \\
\midrule
\multicolumn{1}{p{4.055em}}{\textbf{Wealth }} & \multicolumn{1}{p{4.055em}}{No} & \multicolumn{1}{p{4.055em}}{ (Yes)} & \multicolumn{1}{p{4.055em}}{(Yes incl. vehicles)} & \multicolumn{1}{p{4.055em}}{(Yes incl. vehicles)} & \multicolumn{1}{p{4.055em}}{No} & \multicolumn{1}{p{4.055em}}{ (Yes)} & \multicolumn{1}{p{4.055em}}{(Yes* incl. vehicles)} \\
\midrule
\multicolumn{1}{p{4.055em}}{\textbf{Housing costs}} & \multicolumn{1}{p{4.055em}}{No cap} & \multicolumn{1}{p{4.055em}}{No cap} & \multicolumn{1}{p{4.055em}}{No cap} & \multicolumn{1}{p{4.055em}}{Imputed for INR} & \multicolumn{1}{p{4.055em}}{No cap} & \multicolumn{1}{p{4.055em}}{No cap} & \multicolumn{1}{p{4.055em}}{No cap} \\
\multicolumn{1}{l}{{\textbf{NTR}}} & \multicolumn{1}{c}{{\textbf{52.06}}} & \multicolumn{1}{r}{{\textbf{43.09}}} & \multicolumn{1}{c}{{\textbf{42.01}}} & \multicolumn{1}{c}{{\textbf{42.25}}} & \multicolumn{1}{c}{{\textbf{50.35}}} & \multicolumn{1}{c}{{\textbf{40.42}}} & \multicolumn{1}{c}{{\textbf{38.62}}} \\
& & & & & & & \\
\multicolumn{1}{l}{{\textbf{NTR }}} & \multicolumn{1}{c}{{\textbf{46.26}}} & \multicolumn{1}{c}{{\textbf{36.45}}} & \multicolumn{1}{c}{{\textbf{35.16}}} & \multicolumn{1}{c}{{\textbf{35.48}}} & \multicolumn{1}{c}{{\textbf{43.87}}} & \multicolumn{1}{c}{{\textbf{33.12}}} & \multicolumn{1}{c}{{\textbf{31.24}}} \\
& & & & & & & \\
\multicolumn{1}{p{4.055em}}{\textbf{Beta-error rate}} & \multicolumn{1}{c}{{\textbf{12.52}}} & \multicolumn{1}{c}{{\textbf{18.22}}} & \multicolumn{1}{c}{{\textbf{19.49}}} & \multicolumn{1}{c}{{\textbf{19.09}}} & \multicolumn{1}{c}{{\textbf{14.77}}} & \multicolumn{1}{c}{{\textbf{22.04}}} & \multicolumn{1}{c}{{\textbf{23.61}}} \\
& & & & & & & \\
\midrule
& \multicolumn{2}{p{8.11em}}{\textbf{Needs}} & & \multicolumn{2}{p{8.11em}}{\textbf{Income}} & \multicolumn{2}{p{8.11em}}{\textbf{Housing}} \\
\midrule
\multicolumn{1}{p{4.055em}}{\textbf{∆}} & \multicolumn{1}{p{4.055em}}{\textbf{↑ +5\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↓ -5\%}} & & \multicolumn{1}{p{4.055em}}{\textbf{↑ +5\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↓ -5\% }} & \multicolumn{1}{p{4.055em}}{\textbf{↑ +5\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↓ -5\%}} \\
\midrule
\multicolumn{1}{p{4.055em}}{\textbf{NTR}} & \multicolumn{1}{p{4.055em}}{\textbf{43.32}} & \multicolumn{1}{p{4.055em}}{\textbf{41.16}} & & \multicolumn{1}{p{4.055em}}{\textbf{41.01}} & \multicolumn{1}{p{4.055em}}{\textbf{43.75}} & \multicolumn{1}{p{4.055em}}{\textbf{42.4}} & \multicolumn{1}{p{4.055em}}{\textbf{41.92}} \\
\multicolumn{1}{p{4.055em}}{\textbf{Beta-error rate}} & \multicolumn{1}{l}{{\textbf{17.92}}} & \multicolumn{1}{l}{{\textbf{21.44}}} & & \multicolumn{1}{l}{{\textbf{20.45}}} & \multicolumn{1}{l}{{\textbf{18.56}}} & \multicolumn{1}{l}{{\textbf{19.25}}} & \multicolumn{1}{l}{{\textbf{19.89}}} \\
& & & & & & & \\
\multicolumn{1}{p{4.055em}}{\textbf{∆}} & \multicolumn{1}{p{4.055em}}{\textbf{↑+10\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↓ -10\%}} & & \multicolumn{1}{p{4.055em}}{\textbf{↑ +10\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↓ -10\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↑+10\%}} & \multicolumn{1}{p{4.055em}}{\textbf{↓ -10\%}} \\
\multicolumn{1}{p{4.055em}}{\textbf{NTR}} & \multicolumn{1}{p{4.055em}}{\textbf{44.99}} & \multicolumn{1}{p{4.055em}}{\textbf{39.81}} & & \multicolumn{1}{p{4.055em}}{\textbf{39.5}} & \multicolumn{1}{p{4.055em}}{\textbf{45.6}} & \multicolumn{1}{p{4.055em}}{\textbf{42.94}} & \multicolumn{1}{p{4.055em}}{\textbf{42.04}} \\
\multicolumn{1}{p{4.055em}}{\textbf{Beta-error rate}} & \multicolumn{1}{p{4.055em}}{\textbf{16.16}} & \multicolumn{1}{p{4.055em}}{\textbf{23.42}} & & \multicolumn{1}{c}{\textbf{21.03}} & \multicolumn{1}{c}{\textbf{17.8}} & \multicolumn{1}{p{4.055em}}{\textbf{19.35}} & \multicolumn{1}{p{4.055em}}{\textbf{20.54}} \\
\midrule
& & & & & & & \\
\end{tabular}%
\label{tab:addlabel}%
{\raggedright \*{*All specifications listed here are for the month of interview and core family or referring to (HH). NTR refers to caseloads. Sensitivity checks are done for model (c). Denominator incl. Beta-error. \par}}
\end{table}%
\end{document}
我认为你应该考虑直接用 LaTeX 编写表格,而不是使用 excel2latex。有很多无用的\multicolumn{1}{...}
,这只会使代码更难阅读。