表中缺少 } 错误

表中缺少 } 错误

使用 rmarkdown 编译 pdf 文档中的 longtable 时,我收到缺少 } 的错误。表格编织成 html,所以我认为问题出在正在生成的 latex 上,我无法确定为什么}需要 a。这是错误:

! Missing } inserted.
<inserted text> 
                }
l.152 Brantsma  2014 &
                        & 49 & 6647 & 4.2 & Also measured risk factors over ...

这是 .tex 输出:

% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
  11pt,
]{article}
\usepackage{amsmath,amssymb}
\usepackage{lmodern}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math}
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
  \setmainfont[]{Garamond}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
  hidelinks,
  pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage[margin=1in]{geometry}
\usepackage{longtable,booktabs,array}
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
\usepackage{pdflscape}
\usepackage{longtable}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{caption}
\usepackage{subfig}
\definecolor{pastelred}{rgb}{1.0, 0.41, 0.38}
\definecolor{lightcornflowerblue}{rgb}{0.6, 0.81, 0.93}
\definecolor{mintgreen}{rgb}{0.6, 1.0, 0.6}
\definecolor{lavender}{rgb}{0.8, 0.8, 1.0}
\definecolor{icterine}{rgb}{0.99, 0.97, 0.37}
\definecolor{lsilver}{rgb}{0.93, 0.93, 0.93}
\newcommand{\pr}[1]{\textcolor{pastelred}{#1}}
\newcommand{\mg}[1]{\textcolor{mintgreen}{#1}}
\newcommand{\ic}[1]{\textcolor{icterine}{#1}}
\newcommand{\bl}[1]{\textcolor{lightcornflowerblue}{#1}}
\newcommand{\pu}[1]{\textcolor{lavender}{#1}} \let\counterwithout\relax \let\counterwithin\relax \usepackage{chngcntr} \counterwithin{figure}{section} \counterwithin{table}{section}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{colortbl}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage{makecell}
\usepackage{xcolor}
\ifluatex
  \usepackage{selnolig}  % disable illegal ligatures
\fi

\author{}
\date{\vspace{-2.5em}}

\begin{document}

{
\setcounter{tocdepth}{3}
\tableofcontents
}
\listoftables
\listoffigures



\fontspec[Path= Fonts/]{Helvetica}

\begin{landscape}\begingroup\fontsize{10}{12}\selectfont

\begin{longtable}[t]{>{\raggedright\arraybackslash}p{6em}>{\raggedright\arraybackslash}p{8em}>{\raggedleft\arraybackslash}p{5em}>{\raggedleft\arraybackslash}p{2em}>{\raggedleft\arraybackslash}p{5em}>{\raggedright\arraybackslash}p{4em}>{\raggedright\arraybackslash}p{5em}>{\raggedright\arraybackslash}p{4em}>{\raggedright\arraybackslash}p{4em}>{\raggedright\arraybackslash}p{4em}>{\raggedright\arraybackslash}p{4em}>{\raggedright\arraybackslash}p{9em}>{\raggedright\arraybackslash}p{9em}}
\caption{\label{tab:genpop}(ref:genpopcap)}\\
\toprule
First author, Year & Population & Mean age & Participants (n) & Follow up (years) & Analysis & Outcome & 1st & 2nd & 3rd & 4th & Other significant & Non-significant\\
\midrule
\endfirsthead
\caption[]{\textit{(continued)}}\\
\toprule
First author, Year & Population & Mean age & Participants (n) & Follow up (years) & Analysis & Outcome & 1st & 2nd & 3rd & 4th & Other significant & Non-significant\\
\midrule
\endhead

\endfoot
\bottomrule
\multicolumn{13}{l}{\rule{0pt}{1em}BP variables = red}\\
\endlastfoot
Hsu  2009 & Medical insurance check up & 40 & 177570 & 25.0 &  & ESRD & \cellcolor{white}{BMI (category)} & \cellcolor{white}{Hypertension (stage)} & \cellcolor{mintgreen}{Diabetes (Y/N)} & \cellcolor{white}{Uric acid (highest quartile)} & Dipstick proteinuria\*, race, age, education, low Hb & \cellcolor{lsilver}{Lipids}\\
Hallan  2009 & General population & 50 & 65589 & 10.0 & ACR and eGFR not included & ESRD/Death & \cellcolor{mintgreen}{Diabetes (present)} & \cellcolor{white}{Low physical activity} & \cellcolor{pastelred}{SBP} & \cellcolor{lavender}{Low HDL} & eGFR\* \& ACR\* (in full model), antihypertensive treatment, male sex, age & \cellcolor{lsilver}{}\\
Bash  2010 & Age 45-64 & 54 & 15324 & 16.0 &  & ESRD & \cellcolor{mintgreen}{Diabetes (present)} & \cellcolor{white}{Triglycerides} & \cellcolor{pastelred}{SBP} & \cellcolor{icterine}{BMI} & Race, smoking, age, CHD, male sex & \cellcolor{lsilver}{}\\
Ryu  2009 & Men, age 30-59 & 37 & 10685 & 3.8 &  & Incident CKD (eGFR<60) & \cellcolor{lavender}{Low HDL} & \cellcolor{white}{Triglycerides} & \cellcolor{white}{} & \cellcolor{white}{} & HOMA-IR & \cellcolor{lsilver}{Obesity, hypertension, raised fasting glucose}\\
Hemmelgarn  2006 & Age>66, mean eGFR 60-89 & 76 & 6789 & 2.0 &  & eGFR decline & \cellcolor{mintgreen}{Diabetes (present)} & \cellcolor{white}{} & \cellcolor{white}{} & \cellcolor{white}{} & Age, cardiac disease gout & \cellcolor{lsilver}{Hypertension}\\
\addlinespace
Chien  2010 & eGFR >60 & 51 & 5168 & 2.2 & "Clinical" parameters & Incident CKD (eGFR<60) & \cellcolor{white}{T2DM (present)} & \cellcolor{icterine}{BMI} & \cellcolor{pastelred}{DBP} & \cellcolor{white}{} & Age, Hx of stroke & \cellcolor{lsilver}{Regular exercise (Y/N)}\\
Chien  2010 & eGFR >60 & 51 & 5168 & 2.2 & "Biochemical" parameters. eGFR not included & Incident CKD (eGFR<60) & \cellcolor{white}{Uric acid} & \cellcolor{white}{HBA1c} & \cellcolor{pastelred}{DBP} & \cellcolor{white}{} & Proteinuria\*, Hx of stroke\*, age & \cellcolor{lsilver}{}\\
Wang  2011 & Age >40, general population & 60 & 1563 & 4.0 &  & eGFR decline & \cellcolor{white}{Uric acid} & \cellcolor{white}{} & \cellcolor{white}{} & \cellcolor{white}{} & Albuminuria\*, age & \cellcolor{lsilver}{Diabetes, eGFR(<60 vs >60), SBP}\\
Polonia  2017 & Hypertensive & 60 & 1023 & 5.0 &  & eGFR decline & \cellcolor{white}{HbA1C (>8%)} & \cellcolor{white}{T2DM (present)} & \cellcolor{white}{Nighttime SBP} & \cellcolor{white}{} & Albuminuria\*, age & \cellcolor{lsilver}{LDL, Triglycerides}\\
Brantsma  2014 &  & 49 & 6647 & 4.2 & Also measured risk factors over time $\Delta$ & Albuminuria progression & \cellcolor{white}{Baseline MAP \& $\Delta$ MAP} & \cellcolor{white}{Use of lipid lowering agents} & \cellcolor{icterine}{BMI} & \cellcolor{white}{$\Delta$ fasting glucose} & Age & \cellcolor{lsilver}{Cholesterol, CRP, HOMA-IR, Smoking}\\
\addlinespace
Guesseous  2014 & General population & 52 & 4441 & 5.0 &  & eGFR decline & \cellcolor{white}{T2DM (present)} & \cellcolor{white}{Hypertension (Y/N)} & \cellcolor{lightgray}{CRP} & \cellcolor{white}{} & Education level, Contraceptive pill, eGFR, ACR & \cellcolor{lsilver}{Smoking, Uric acid}\\
Kronborg  2008 & General population & 59 & 2249 & 7.0 & Men & eGFR decline & \cellcolor{mintgreen}{Diabetes (Y/N)} & \cellcolor{white}{Anti-hypertensive treatment (Y/N)} & \cellcolor{pastelred}{SBP} & \cellcolor{white}{Fibrinogen} & Alcohol (>6Units/week) CVD, ACR, HbA1C in non-diabetics & \cellcolor{lsilver}{Cholesterol Smoking Waist circumference}\\
Kronborg  2008 & General population & 59 & 2192 & 7.0 & Women & eGFR decline & \cellcolor{mintgreen}{Diabetes (Y/N)} & \cellcolor{white}{Anti-hypertensive treatment (Y/N)} & \cellcolor{white}{Low physical activity} & \cellcolor{white}{Fibrinogen} & Age, SBP, HbA1c in non-diabetics & \cellcolor{lsilver}{ACR Cholesterol Waist circumference}\\
Fox  2004 &  & 43 & 2585 & 8.5 & Baseline variables & Incident CKD (eGFR<60) & \cellcolor{mintgreen}{Diabetes (Y/N)} & \cellcolor{white}{Smoking} & \cellcolor{icterine}{BMI} & \cellcolor{white}{} & eGFR\*, age\*, male sex & \cellcolor{lsilver}{Cholesterol, Impaired fasting glucose, SBP}\\
Fox  2004 &  & 43 & 2585 & 8.5 & Long-term (time averaged) & Incident CKD (eGFR<60) & \cellcolor{mintgreen}{Diabetes (Y/N)} & \cellcolor{white}{Hypertension (Y/N)} & \cellcolor{lavender}{Low HDL} & \cellcolor{white}{} & Baseline eGFR\*, age\*, male sex & \cellcolor{lsilver}{BMI, Impaired fasting glucose, SBP}\\
\addlinespace
Obermayr 2008 & Exclude eGFR<60 & 44 & 17375 & 7.2 &  & Incident CKD (eGFR<60) & \cellcolor{white}{Hypertension (stage)} & \cellcolor{white}{Uric acid} & \cellcolor{white}{Low physical activity} & \cellcolor{lavender}{Fasting glucose (>100 mg/dl)} & Proteinuria\*, female sex, age, smoker, low HDL, BMI & \cellcolor{lsilver}{}\\*
\end{longtable}
\endgroup{}
\end{landscape}

\end{document}

答案1

你有 \cellcolor{white}{HbA1C (>8%)

它应该是\cellcolor{white}{HbA1C (>8\%),因为百分号强制 TeX 忽略该行其余部分的所有内容,在本例中是结尾的}

相关内容