我使用这个网站毫无问题地为中小型表格生成了快速的 Latex 代码:https://www.tablesgenerator.com/
这次我尝试构建一个非常长的表格,它需要多页。当我使用 table/tabular 环境时,我没有遇到问题,但表格只有一页,它没有继续下一页,所以没用。当我尝试 longtable 环境时,我收到以下错误:
! Argument of \@let@token has an extra }
! Paragraph ended before \@let@token was complete.
! Paragraph ended before \contentsline was complete
我认为网站在定义颜色时是多余的,但这是整个代码:
\documentclass[a4paper]{book}
\usepackage[table,xcdraw]{xcolor}
\usepackage[spanish,es-tabla,es-nodecimaldot]{babel}
\usepackage[titletoc]{appendix}
\usepackage{ragged2e}
\usepackage[numbers]{natbib}
\usepackage{amssymb}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{longtable}
\usepackage{enumerate} % needed for some options in enumerate
\usepackage{makeidx} % needed for creating an index
\usepackage{blindtext}
\usepackage{amsmath}
\usepackage{bigstrut}
\usepackage{upgreek}
\usepackage{listings}
\usepackage{color}
\usepackage{graphicx}
\usepackage{array}
\usepackage{tikz}
\usepackage[nottoc]{tocbibind}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{pdfpages}
\usepackage{pdflscape}
\usepackage{titletoc}
\usepackage{tcolorbox}
\usepackage[top=2cm, bottom=1.8cm,left=2.5cm,right=2.5cm]{geometry} % needed for page border settings
\usepackage[colorlinks=true,citecolor=black,linkcolor=black,urlcolor=black]{hyperref}
\usepackage{bookmark}
\usepackage{longtable}
\tcbuselibrary{skins}
\begin{document}
\frontmatter
\listoffigures
\newpage
\listoftables
\newpage
\tableofcontents
\mainmatter
\chapter{First chapter}
\section{F1}
\begin{appendices}
\chapter{Table}
\begin{longtable}{|
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |}
\caption{My caption}
\label{my-label}\\
\hline
{\color[HTML]{000000} \textbf{Cantidad}} & {\color[HTML]{000000} \textbf{Designante}} & {\color[HTML]{000000} \textbf{Referencia}} & {\color[HTML]{000000} \textbf{Encapsulado}} & {\color[HTML]{000000} \textbf{No. de parte}} \\ \hline
\endfirsthead
%
\endhead
%
{\color[HTML]{000000} 1} & {\color[HTML]{000000} AC/DC Converter} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Power Module\\ 20W 85-264Vin 5Vout 4A\end{tabular}} & {\color[HTML]{000000} -} & {\color[HTML]{000000} RAC20-05SK} \\ \hline
{\color[HTML]{000000} 7} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}TP1, TP2, TP3, TP4, TP5\\ TP6, TP7\end{tabular}} & {\color[HTML]{000000} Test points} & {\color[HTML]{000000} SMD} & {\color[HTML]{000000} 5019} \\ \hline
{\color[HTML]{000000} 7} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}AC1, AC2, AC3, AC4\\ AC5, M+, M-\end{tabular}} & {\color[HTML]{000000} Metal Terminals PCB} & {\color[HTML]{000000} -} & {\color[HTML]{000000} 726386-2} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} F1} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Fusible Cerámica\\ 25A/250\end{tabular}} & {\color[HTML]{000000} 6.3x32mm} & {\color[HTML]{000000} 0314025.MXP} \\ \hline
{\color[HTML]{000000} 2} & {\color[HTML]{000000} F1 (Clips)} & {\color[HTML]{000000} Clips para fusible} & {\color[HTML]{000000} -} & {\color[HTML]{000000} 01220083Z} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} MOV1} & {\color[HTML]{000000} Varistor 150V 2.5kA} & {\color[HTML]{000000} Through Hole} & {\color[HTML]{000000} B72210S0151K101} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R28} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Termistor \\ \$2R 25A\end{tabular}} & {\color[HTML]{000000} -} & {\color[HTML]{000000} SL32 2R025} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} BR1} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Puente Rectificador\\ 35A\end{tabular}} & {\color[HTML]{000000} -} & {\color[HTML]{000000} GBPC3506} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} C1} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Capacitor Aluminio\\ 250V $1500\mu F$\end{tabular}} & {\color[HTML]{000000} Snap In} & {\color[HTML]{000000} 380LX152M250A052} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} C2} & {\color[HTML]{000000} MLCC Capacitor630volts $0.1\mu F$ X7R} & {\color[HTML]{000000} 2225} & {\color[HTML]{000000} C2225C104KBRACTU} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R7} & {\color[HTML]{000000} Resistencia SMD 100k/1W} & {\color[HTML]{000000} 2512} & {\color[HTML]{000000} AC2512JK-07100KL} \\ \hline
{\color[HTML]{000000} 4} & {\color[HTML]{000000} LD1, LD2, LD3, LD6} & {\color[HTML]{000000} SMD LED Red Diffused} & {\color[HTML]{000000} 0603} & {\color[HTML]{000000} EL-19-217/R6C-ALM2VY/3T} \\ \hline
{\color[HTML]{000000} 7} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}R4, R6, R15, R9, R36, \\ R34, R18\end{tabular}} & {\color[HTML]{000000} Resistencia SMD 10k 1/8W} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} AT0805BRD0710KL} \\ \hline
{\color[HTML]{000000} 4} & {\color[HTML]{000000} R1, R2, R11, R35} & {\color[HTML]{000000} Resistencia SMD 174R 1/8W} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} RC0805FR-07174RL} \\ \hline
{\color[HTML]{000000} 10} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}R3, R14, R20, R21, R42\\ R38, R39, R16, R17, R33\end{tabular}} & {\color[HTML]{000000} Resistencia SMD 1k 1/8W} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} RT0805CRE071KL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R5} & {\color[HTML]{000000} Resistencia SMD 39R 1/4W} & {\color[HTML]{000000} 1206} & {\color[HTML]{000000} RT1206BRD0739RL} \\ \hline
{\color[HTML]{000000} 3} & {\color[HTML]{000000} Q1, Q2, Q3} & {\color[HTML]{000000} BJT NPN 0.6A 40V} & {\color[HTML]{000000} SOT-23-3} & {\color[HTML]{000000} SST2222AHZGT116} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} LD5} & {\color[HTML]{000000} Green SMD LED} & {\color[HTML]{000000} 0603} & {\color[HTML]{000000} 19-21SYGC/S530-E2/TR8} \\ \hline
{\color[HTML]{000000} 2} & {\color[HTML]{000000} VO1, VO2} & {\color[HTML]{000000} OPTOISOLATOR 4.17KV TRIAC} & {\color[HTML]{000000} 6-SMD} & {\color[HTML]{000000} MOC3061SM} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} TR1} & {\color[HTML]{000000} Triac 600V 35A} & {\color[HTML]{000000} TO-220-2} & {\color[HTML]{000000} Q6035RH5} \\ \hline
{\color[HTML]{000000} 2} & {\color[HTML]{000000} C3, C4} & {\color[HTML]{000000} Capacitor de película0.01$\mu F$ 630V} & {\color[HTML]{000000} Radial} & {\color[HTML]{000000} BFC236969103} \\ \hline
{\color[HTML]{000000} 4} & {\color[HTML]{000000} R8, R10, R12, R13} & {\color[HTML]{000000} Resistencia SMD 330R 1/8W} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} RE0805FRE07330RL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} K1} & {\color[HTML]{000000} Relay 5VDC 1 Form C (SPDT-NO, NC)} & {\color[HTML]{000000} -} & {\color[HTML]{000000} ALQ105} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} D6} & {\color[HTML]{000000} Fast Rectifier Diode 2.0A} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}SMB\\ DO-214AA\end{tabular}} & {\color[HTML]{000000} 512-ES2D} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} TR2} & {\color[HTML]{000000} Triac 16 A 600 V} & {\color[HTML]{000000} D2PAK} & {\color[HTML]{000000} T1650-600G-TR} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} LD4} & {\color[HTML]{000000} LED SMD Blue Water Clear} & {\color[HTML]{000000} 0603} & {\color[HTML]{000000} EL-19-21/BHC-AN1P2/3T} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R24} & {\color[HTML]{000000} Resistencia SMD 680R 1/8W} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} RC0805FR-07680RL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U7} & {\color[HTML]{000000} Gate Drivers} & {\color[HTML]{000000} PG-DSO-8-51} & {\color[HTML]{000000} 1EDI60N12AF} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U6} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Isolated DC/DC Converters \\ 1W 05Vin 12Vout 84mA\end{tabular}} & {\color[HTML]{000000} SMD} & {\color[HTML]{000000} R1SE-0512/H2-R} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U8} & {\color[HTML]{000000} Board Mount Current Sensors} & {\color[HTML]{000000} PG-TISON-8-1} & {\color[HTML]{000000} TLI4970D050T5XUMA1} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} Q4} & {\color[HTML]{000000} IGBT TRENCHSTOP 600V 80A} & {\color[HTML]{000000} TO-247-3} & {\color[HTML]{000000} IKW50N60DTPXKSA1} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} D5} & {\color[HTML]{000000} Rectifiers 50A, 600V Ultrafast Diode} & {\color[HTML]{000000} TO-247-2} & {\color[HTML]{000000} RURG5060-F085} \\ \hline
{\color[HTML]{000000} 10} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}C5, C7, C9, C10, C13, \\ C15, C10, C16\\ C18, C19,\end{tabular}} & {\color[HTML]{000000} MLCC capacitor 16V 0.1$muF$ X7R} & {\color[HTML]{000000} 0603} & {\color[HTML]{000000} C0603C104J4RAC} \\ \hline
{\color[HTML]{000000} 3} & {\color[HTML]{000000} C6, C11, C12} & {\color[HTML]{000000} Capacitor electrolítico 16V 100$\mu F$} & {\color[HTML]{000000} Radial Leaded} & {\color[HTML]{000000} ULD1C101MED1TD} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} C14} & {\color[HTML]{000000} MLCC Capacitor 25V 1$muF$ X7R} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} C0805C105J3RACTU} \\ \hline
{\color[HTML]{000000} 2} & {\color[HTML]{000000} R29, R30} & {\color[HTML]{000000} Resistencia SMD 10R 1/2W} & {\color[HTML]{000000} 1210} & {\color[HTML]{000000} RC1210JR-0710RL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R25} & {\color[HTML]{000000} Resistencia SMD 1/8W 100k} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} RC0805DR-07100KL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R26} & {\color[HTML]{000000} Resistencia SMD 1/8W 47k} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} RT0805BRD0747KL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R41} & {\color[HTML]{000000} Resistencia SMD 1/8W 20k} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} AT0805BRD0720KL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} D11} & {\color[HTML]{000000} TVS Diodes 600W 5.0V} & {\color[HTML]{000000} SMB} & {\color[HTML]{000000} SMBJ5.0A-TR} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} J1, J2} & {\color[HTML]{000000} CONN HEADER VERT 3POS 2.54MM} & {\color[HTML]{000000} Through Hole} & {\color[HTML]{000000} SWR25X-NRTC-S03-ST-BA} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U2} & {\color[HTML]{000000} Op Amps Dual 2.7V} & {\color[HTML]{000000} SOIC-8} & {\color[HTML]{000000} MCP602-I/SN} \\ \hline
{\color[HTML]{000000} 3} & {\color[HTML]{000000} JP1, JP2, JP5} & {\color[HTML]{000000} 2.54mm Hdr 3P Single Str Gold} & {\color[HTML]{000000} Straight Pin} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Pin: 61300311121\\ Jumper: 382811-8\end{tabular}} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U1} & {\color[HTML]{000000} Analog Dual Comparators} & {\color[HTML]{000000} SOIC-8} & {\color[HTML]{000000} LM393MX/NOPB} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} J3} & {\color[HTML]{000000} CONN HEADER VERT 4POS 2.54MM} & {\color[HTML]{000000} Through Hole} & {\color[HTML]{000000} SWR25X-NRTC-S04-ST-BA} \\ \hline
{\color[HTML]{000000} 2} & {\color[HTML]{000000} R19, R22, R27} & {\color[HTML]{000000} Resistencia SMD 1/8W 100R} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} AT0805DRD07100RL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} Microcontrolador} & {\color[HTML]{000000} Development Boards \& Kits - ARM STM32} & {\color[HTML]{000000} -} & {\color[HTML]{000000} NUCLEO-L432KC} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U3} & {\color[HTML]{000000} LVDS Interface IC Single Full-Duplex} & {\color[HTML]{000000} SOIC-8 150mil} & {\color[HTML]{000000} SN65LVDS179DR} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} C8} & {\color[HTML]{000000} MLCC Capacitor 10V 1000pF} & {\color[HTML]{000000} 0402} & {\color[HTML]{000000} C0402C102J8RACTU} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U5} & {\color[HTML]{000000} Ethernet Connectors Female 8P Vertical} & {\color[HTML]{000000} Through Hole} & {\color[HTML]{000000} 615008138021} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} C17} & {\color[HTML]{000000} MLCC Capacitor 16V 1$muF$ X7R} & {\color[HTML]{000000} 0603} & {\color[HTML]{000000} C0603X105M4RACAUTO} \\ \hline
\end{longtable}
\newpage
\chapter{Another appendix}
\end{appendices}
\end{document}
答案1
这里有两个问题(除了表格太宽之外——但是我没有解决这个“特征”)
第一个问题:\usepackage[spanish]{babel}
需要特殊的字体编码,所以\usepackage[T1]{fontenc}
是必要的。
第二个问题:该appendix
软件包使用了附录名称的 Babel 形式,即Apéndice
,用来hyperref
创建超锚点,导致锚点名称带有重音,从而彻底失败。
解决方案是强制在 中的章节中使用另一个锚点名称前缀appendices
,即\def\Hy@chap{appendixchapters}
(或其他不会破坏链接系统和其他命令的东西)。这是通过\xapptocmd
之前的设置完成的\begin{document}
。
\documentclass[a4paper]{book}
\usepackage[table,xcdraw]{xcolor}
\usepackage[T1]{fontenc}
\usepackage[spanish,es-tabla,es-nodecimaldot]{babel}
\usepackage[titletoc]{appendix}
\usepackage{ragged2e}
\usepackage[numbers]{natbib}
\usepackage{amssymb}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{enumerate} % needed for some options in enumerate
\usepackage{makeidx} % needed for creating an index
\usepackage{blindtext}
\usepackage{amsmath}
\usepackage{bigstrut}
\usepackage{upgreek}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{array}
\usepackage{tikz}
\usepackage[nottoc]{tocbibind}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{pdfpages}
\usepackage{pdflscape}
\usepackage{titletoc}
\usepackage{tcolorbox}
\usepackage[top=2cm, bottom=1.8cm,left=2.5cm,right=2.5cm]{geometry} % needed for page border settings
\usepackage[pdfencoding=auto,colorlinks=true,citecolor=black,linkcolor=black,urlcolor=black]{hyperref}
\usepackage{longtable}
\usepackage{bookmark}
\usepackage{xpatch}
\tcbuselibrary{skins}
\makeatletter
\xapptocmd{\appendices}{%
\def\Hy@chapapp{appendixchapters}%
}{}{}
\makeatother
\begin{document}
\frontmatter
\listoffigures
\newpage
\listoftables
\newpage
\tableofcontents
\mainmatter
\chapter{First chapter}
\section{F1}
\begin{appendices}
\chapter{Table}
\begin{longtable}{|
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{FFFFFF}}c |}
\caption{My caption}
\label{my-label}\\
\hline
{\color[HTML]{000000} \textbf{Cantidad}} & {\color[HTML]{000000} \textbf{Designante}} & {\color[HTML]{000000} \textbf{Referencia}} & {\color[HTML]{000000} \textbf{Encapsulado}} & {\color[HTML]{000000} \textbf{No. de parte}} \\ \hline
\endfirsthead
%
\endhead
%
{\color[HTML]{000000} 1} & {\color[HTML]{000000} AC/DC Converter} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Power Module\\ 20W 85-264Vin 5Vout 4A\end{tabular}} & {\color[HTML]{000000} -} & {\color[HTML]{000000} RAC20-05SK} \\ \hline
{\color[HTML]{000000} 7} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}TP1, TP2, TP3, TP4, TP5\\ TP6, TP7\end{tabular}} & {\color[HTML]{000000} Test points} & {\color[HTML]{000000} SMD} & {\color[HTML]{000000} 5019} \\ \hline
{\color[HTML]{000000} 7} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}AC1, AC2, AC3, AC4\\ AC5, M+, M-\end{tabular}} & {\color[HTML]{000000} Metal Terminals PCB} & {\color[HTML]{000000} -} & {\color[HTML]{000000} 726386-2} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} F1} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Fusible Cerámica\\ 25A/250\end{tabular}} & {\color[HTML]{000000} 6.3x32mm} & {\color[HTML]{000000} 0314025.MXP} \\ \hline
{\color[HTML]{000000} 2} & {\color[HTML]{000000} F1 (Clips)} & {\color[HTML]{000000} Clips para fusible} & {\color[HTML]{000000} -} & {\color[HTML]{000000} 01220083Z} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} MOV1} & {\color[HTML]{000000} Varistor 150V 2.5kA} & {\color[HTML]{000000} Through Hole} & {\color[HTML]{000000} B72210S0151K101} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R28} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Termistor \\ \$2R 25A\end{tabular}} & {\color[HTML]{000000} -} & {\color[HTML]{000000} SL32 2R025} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} BR1} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Puente Rectificador\\ 35A\end{tabular}} & {\color[HTML]{000000} -} & {\color[HTML]{000000} GBPC3506} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} C1} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Capacitor Aluminio\\ 250V $1500\mu F$\end{tabular}} & {\color[HTML]{000000} Snap In} & {\color[HTML]{000000} 380LX152M250A052} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} C2} & {\color[HTML]{000000} MLCC Capacitor630volts $0.1\mu F$ X7R} & {\color[HTML]{000000} 2225} & {\color[HTML]{000000} C2225C104KBRACTU} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R7} & {\color[HTML]{000000} Resistencia SMD 100k/1W} & {\color[HTML]{000000} 2512} & {\color[HTML]{000000} AC2512JK-07100KL} \\ \hline
{\color[HTML]{000000} 4} & {\color[HTML]{000000} LD1, LD2, LD3, LD6} & {\color[HTML]{000000} SMD LED Red Diffused} & {\color[HTML]{000000} 0603} & {\color[HTML]{000000} EL-19-217/R6C-ALM2VY/3T} \\ \hline
{\color[HTML]{000000} 7} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}R4, R6, R15, R9, R36, \\ R34, R18\end{tabular}} & {\color[HTML]{000000} Resistencia SMD 10k 1/8W} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} AT0805BRD0710KL} \\ \hline
{\color[HTML]{000000} 4} & {\color[HTML]{000000} R1, R2, R11, R35} & {\color[HTML]{000000} Resistencia SMD 174R 1/8W} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} RC0805FR-07174RL} \\ \hline
{\color[HTML]{000000} 10} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}R3, R14, R20, R21, R42\\ R38, R39, R16, R17, R33\end{tabular}} & {\color[HTML]{000000} Resistencia SMD 1k 1/8W} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} RT0805CRE071KL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R5} & {\color[HTML]{000000} Resistencia SMD 39R 1/4W} & {\color[HTML]{000000} 1206} & {\color[HTML]{000000} RT1206BRD0739RL} \\ \hline
{\color[HTML]{000000} 3} & {\color[HTML]{000000} Q1, Q2, Q3} & {\color[HTML]{000000} BJT NPN 0.6A 40V} & {\color[HTML]{000000} SOT-23-3} & {\color[HTML]{000000} SST2222AHZGT116} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} LD5} & {\color[HTML]{000000} Green SMD LED} & {\color[HTML]{000000} 0603} & {\color[HTML]{000000} 19-21SYGC/S530-E2/TR8} \\ \hline
{\color[HTML]{000000} 2} & {\color[HTML]{000000} VO1, VO2} & {\color[HTML]{000000} OPTOISOLATOR 4.17KV TRIAC} & {\color[HTML]{000000} 6-SMD} & {\color[HTML]{000000} MOC3061SM} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} TR1} & {\color[HTML]{000000} Triac 600V 35A} & {\color[HTML]{000000} TO-220-2} & {\color[HTML]{000000} Q6035RH5} \\ \hline
{\color[HTML]{000000} 2} & {\color[HTML]{000000} C3, C4} & {\color[HTML]{000000} Capacitor de película0.01$\mu F$ 630V} & {\color[HTML]{000000} Radial} & {\color[HTML]{000000} BFC236969103} \\ \hline
{\color[HTML]{000000} 4} & {\color[HTML]{000000} R8, R10, R12, R13} & {\color[HTML]{000000} Resistencia SMD 330R 1/8W} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} RE0805FRE07330RL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} K1} & {\color[HTML]{000000} Relay 5VDC 1 Form C (SPDT-NO, NC)} & {\color[HTML]{000000} -} & {\color[HTML]{000000} ALQ105} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} D6} & {\color[HTML]{000000} Fast Rectifier Diode 2.0A} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}SMB\\ DO-214AA\end{tabular}} & {\color[HTML]{000000} 512-ES2D} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} TR2} & {\color[HTML]{000000} Triac 16 A 600 V} & {\color[HTML]{000000} D2PAK} & {\color[HTML]{000000} T1650-600G-TR} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} LD4} & {\color[HTML]{000000} LED SMD Blue Water Clear} & {\color[HTML]{000000} 0603} & {\color[HTML]{000000} EL-19-21/BHC-AN1P2/3T} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R24} & {\color[HTML]{000000} Resistencia SMD 680R 1/8W} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} RC0805FR-07680RL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U7} & {\color[HTML]{000000} Gate Drivers} & {\color[HTML]{000000} PG-DSO-8-51} & {\color[HTML]{000000} 1EDI60N12AF} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U6} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Isolated DC/DC Converters \\ 1W 05Vin 12Vout 84mA\end{tabular}} & {\color[HTML]{000000} SMD} & {\color[HTML]{000000} R1SE-0512/H2-R} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U8} & {\color[HTML]{000000} Board Mount Current Sensors} & {\color[HTML]{000000} PG-TISON-8-1} & {\color[HTML]{000000} TLI4970D050T5XUMA1} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} Q4} & {\color[HTML]{000000} IGBT TRENCHSTOP 600V 80A} & {\color[HTML]{000000} TO-247-3} & {\color[HTML]{000000} IKW50N60DTPXKSA1} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} D5} & {\color[HTML]{000000} Rectifiers 50A, 600V Ultrafast Diode} & {\color[HTML]{000000} TO-247-2} & {\color[HTML]{000000} RURG5060-F085} \\ \hline
{\color[HTML]{000000} 10} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}C5, C7, C9, C10, C13, \\ C15, C10, C16\\ C18, C19,\end{tabular}} & {\color[HTML]{000000} MLCC capacitor 16V 0.1$muF$ X7R} & {\color[HTML]{000000} 0603} & {\color[HTML]{000000} C0603C104J4RAC} \\ \hline
{\color[HTML]{000000} 3} & {\color[HTML]{000000} C6, C11, C12} & {\color[HTML]{000000} Capacitor electrolítico 16V 100$\mu F$} & {\color[HTML]{000000} Radial Leaded} & {\color[HTML]{000000} ULD1C101MED1TD} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} C14} & {\color[HTML]{000000} MLCC Capacitor 25V 1$muF$ X7R} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} C0805C105J3RACTU} \\ \hline
{\color[HTML]{000000} 2} & {\color[HTML]{000000} R29, R30} & {\color[HTML]{000000} Resistencia SMD 10R 1/2W} & {\color[HTML]{000000} 1210} & {\color[HTML]{000000} RC1210JR-0710RL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R25} & {\color[HTML]{000000} Resistencia SMD 1/8W 100k} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} RC0805DR-07100KL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R26} & {\color[HTML]{000000} Resistencia SMD 1/8W 47k} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} RT0805BRD0747KL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} R41} & {\color[HTML]{000000} Resistencia SMD 1/8W 20k} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} AT0805BRD0720KL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} D11} & {\color[HTML]{000000} TVS Diodes 600W 5.0V} & {\color[HTML]{000000} SMB} & {\color[HTML]{000000} SMBJ5.0A-TR} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} J1, J2} & {\color[HTML]{000000} CONN HEADER VERT 3POS 2.54MM} & {\color[HTML]{000000} Through Hole} & {\color[HTML]{000000} SWR25X-NRTC-S03-ST-BA} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U2} & {\color[HTML]{000000} Op Amps Dual 2.7V} & {\color[HTML]{000000} SOIC-8} & {\color[HTML]{000000} MCP602-I/SN} \\ \hline
{\color[HTML]{000000} 3} & {\color[HTML]{000000} JP1, JP2, JP5} & {\color[HTML]{000000} 2.54mm Hdr 3P Single Str Gold} & {\color[HTML]{000000} Straight Pin} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Pin: 61300311121\\ Jumper: 382811-8\end{tabular}} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U1} & {\color[HTML]{000000} Analog Dual Comparators} & {\color[HTML]{000000} SOIC-8} & {\color[HTML]{000000} LM393MX/NOPB} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} J3} & {\color[HTML]{000000} CONN HEADER VERT 4POS 2.54MM} & {\color[HTML]{000000} Through Hole} & {\color[HTML]{000000} SWR25X-NRTC-S04-ST-BA} \\ \hline
{\color[HTML]{000000} 2} & {\color[HTML]{000000} R19, R22, R27} & {\color[HTML]{000000} Resistencia SMD 1/8W 100R} & {\color[HTML]{000000} 0805} & {\color[HTML]{000000} AT0805DRD07100RL} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} Microcontrolador} & {\color[HTML]{000000} Development Boards \& Kits - ARM STM32} & {\color[HTML]{000000} -} & {\color[HTML]{000000} NUCLEO-L432KC} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U3} & {\color[HTML]{000000} LVDS Interface IC Single Full-Duplex} & {\color[HTML]{000000} SOIC-8 150mil} & {\color[HTML]{000000} SN65LVDS179DR} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} C8} & {\color[HTML]{000000} MLCC Capacitor 10V 1000pF} & {\color[HTML]{000000} 0402} & {\color[HTML]{000000} C0402C102J8RACTU} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} U5} & {\color[HTML]{000000} Ethernet Connectors Female 8P Vertical} & {\color[HTML]{000000} Through Hole} & {\color[HTML]{000000} 615008138021} \\ \hline
{\color[HTML]{000000} 1} & {\color[HTML]{000000} C17} & {\color[HTML]{000000} MLCC Capacitor 16V 1$muF$ X7R} & {\color[HTML]{000000} 0603} & {\color[HTML]{000000} C0603X105M4RACAUTO} \\ \hline
\end{longtable}
\newpage
\chapter{Another appendix}
\end{appendices}
\end{document}
也可以看看
Tex 在联合使用 longtable、appendix、hyperref 和 babel (spanish) 时无法编译。错误:“!\@let@token 的参数有一个额外的 }”
和
答案2
您的代码有两个主要问题是:(a) 代码混乱程度令人难以置信,这可能是由于使用 tablegenerator.com 创建代码造成的longtable
;(b) 它比文本块宽得多。
以下调整可能对解决这两个问题大有帮助:(i) 我应用了\small
(字体大小线性减少 10%),(ii) 减少了列间空白量,(iii) 在单元格内引入了许多新的换行符。我还 (iv) 删除了所有\color
-相关指令,因为它们根本不起作用,(v) 将所有单元格内容从居中对齐改为左对齐(和上对齐)。我还尝试通过 (vi) 删除所有垂直线和 (vi) 用空白替换大多数水平线,让表格看起来更开放。
单独的评论:我强烈建议您加载siunitx
包并使用其\SI
宏来排版科学单位及其相关的数值。如果您\SI
始终如一地使用,您将确保所有单位和数字都以符合当前科学标准的方式排版。我还认为,写成“而不是”\SI{1500}{\micro\farad}
会使$1500\mu F$
输入更容易阅读,如果需要,还可以调试。
下面的截图只显示了完整的前几行longtable
。
\documentclass[a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[spanish,es-tabla,es-nodecimaldot]{babel}
\usepackage[top=2cm, bottom=1.8cm,hmargin=2.5cm]{geometry}
\usepackage[table]{xcolor}
\usepackage{siunitx,booktabs}
\usepackage{longtable}
\newcommand\mytab[1]{%
\begin{tabular}[t]{@{}l@{}} #1 \end{tabular}}
\begin{document}
\begingroup
\small
\setlength\tabcolsep{3pt}
\begin{longtable}{@{} *{5}{l} @{}}
\caption{My caption}
\label{my-label}\\
\toprule
\textbf{Cantidad} & \textbf{Designante} & \textbf{Referencia} & \textbf{Encapsulado} &
\textbf{No.\ de parte}
\\ \midrule
\endfirsthead
\multicolumn{4}{@{}l}{\tablename~\ref{my-label}, cont'd}\\[0.5ex]
\toprule
\textbf{Cantidad} & \textbf{Designante} & \textbf{Referencia} & \textbf{Encapsulado} &
\textbf{No.\ de parte}
\\ \midrule
\endhead
\midrule
\endfoot
\bottomrule
\endlastfoot
1 & AC/DC Converter &
\mytab{Power Module\\ \SI{20}{\watt}, \SIrange{85}{264}{\volt} in, \\ \SI{5}{\volt} out, \SI{4}{\ampere}}
& -- & RAC20-05SK
\\ \addlinespace
7 &
\mytab{TP1, TP2, TP3, TP4,\\ TP5, TP6, TP7}
& Test points & SMD & 5019
\\ \addlinespace
7 &
\mytab{AC1, AC2, AC3, AC4,\\ AC5, M+, M$-$}
& Metal Terminals PCB & -- & 726386-2
\\ \addlinespace
1 & F1 &
\mytab{Fusible Cerámica\\ \SI{25}{\ampere}/250}
& 6.3$\times$32mm & 0314025.MXP
\\ \addlinespace
2 & F1 (Clips) & Clips para fusible & -- & 01220083Z
\\ \addlinespace
1 & MOV1 & Varistor \SI{150}{\volt} \SI{2.5}{\kilo\ampere}
& Through Hole & B72210S0151K101
\\ \addlinespace
1 & R28 &
\mytab{Termistor \\ \$2R \SI{25}{\ampere}}
& -- & SL32 2R025
\\ \addlinespace
1 & BR1 &
\mytab{Puente Rectificador\\ \SI{35}{\ampere}}
& -- & GBPC3506
\\ \addlinespace
1 & C1 &
\mytab{Capacitor Aluminio\\ \SI{250}{\volt} \SI{1500}{\micro\farad}}
& Snap In & 380LX152M250A052
\\ \addlinespace
1 & C2 & \mytab{MLCC Capacitor\\ \SI{630}{\volt} \SI{0.1}{\micro\farad} X7R}
& 2225 & C2225C104KBRACTU
\\ \addlinespace
1 & R7 & \mytab{Resistencia SMD\\100k/\SI{1}{\watt}}
& 2512 & AC2512JK-07100KL
\\ \addlinespace
4 &
\mytab{LD1, LD2, LD3,\\ LD6} & SMD LED Red Diffused & 0603
& \mytab{EL-19-217/\\R6C-ALM2VY/3T}
\\ \addlinespace
7 & \mytab{R4, R6, R15, R9, \\R36, R34, R18}
& \mytab{Resistencia SMD\\10k \SI{1/8}{\watt}}
& 0805 & AT0805BRD0710KL
\\ \addlinespace
4 & R1, R2, R11, R35 &
\mytab{Resistencia SMD\\174R \SI{1/8}{\watt}}
& 0805 & RC0805FR-07174RL
\\ \addlinespace
10 & \mytab{R3, R14, R20, R21,\\
R42, R38, R39, \\R16, R17, R33}
& \mytab{Resistencia SMD\\1k \SI{1/8}{\watt} }
& 0805 & RT0805CRE071KL
\\ \addlinespace
1 & R5 & \mytab{Resistencia SMD\\39R \SI{1/4}{\watt}}
& 1206 & RT1206BRD0739RL
\\ \addlinespace
3 & Q1, Q2, Q3 & BJT NPN \SI{0.6}{\ampere} \SI{40}{\volt}
& SOT-23-3 & SST2222AHZGT116
\\ \addlinespace
1 & LD5 & Green SMD LED & 0603 & \mytab{19-21SYGC/\\S530-E2/TR8}
\\ \addlinespace
2 & VO1, VO2 & \mytab{OPTOISOLATOR\\\SI{4.17}{\kilo\volt} TRIAC}
& 6-SMD & MOC3061SM
\\ \addlinespace
1 & TR1 & Triac \SI{600}{\volt} \SI{35}{\ampere}
& TO-220-2 & Q6035RH5
\\ \addlinespace
2 & C3, C4 &
\mytab{Capacitor de película\\ \SI{0.01}{\micro\farad} \SI{630}{\volt}}
& Radial& BFC236969103
\\ \addlinespace
4 & R8, R10, R12, R13 &
\mytab{Resistencia SMD\\330R 1/8W}
& 0805 & RE0805FRE07330RL
\\ \addlinespace
1 & K1 & \mytab{Relay \SI{5}{\volt} DC 1 Form C\\(SPDT-NO, NC)}
& -- & ALQ105
\\ \addlinespace
1 & D6 & Fast Rectifier Diode \SI{2.0}{\ampere}
& \mytab{SMB\\ DO-214AA} & 512-ES2D
\\ \addlinespace
1 & TR2 & Triac 16 A 600 V & D2PAK & T1650-600G-TR
\\ \addlinespace
1 & LD4 & LED SMD Blue Water Clear & 0603 &
\mytab{EL-19-21/\\ BHC-AN1P2/3T}
\\ \addlinespace
1 & R24 & Resistencia SMD 680R 1/8W & 0805 & RC0805FR-07680RL
\\ \addlinespace
1 & U7 & Gate Drivers & PG-DSO-8-51 & 1EDI60N12AF
\\ \addlinespace
1 & U6 &
\mytab{Isolated DC/DC Converters \\ 1W 05Vin 12Vout 84mA}
& SMD & R1SE-0512/H2-R
\\ \addlinespace
1 & U8 & Board Mount Current Sensors & PG-TISON-8-1 & TLI4970D050T5XUMA1
\\ \addlinespace
1 & Q4 &
\mytab{IGBT TRENCHSTOP\\ \SI{600}{\volt} \SI{80}{\ampere}}
& TO-247-3 & IKW50N60DTPXKSA1
\\ \addlinespace
1 & D5 &
\mytab{Rectifiers \SI{50}{A} \SI{600}{\volt}\\ Ultrafast Diode}
& TO-247-2 & RURG5060-F085
\\ \addlinespace
10 & \mytab{C5, C7, C9, C10, \\C13, C15, C10, \\
C16, C18, C19} &
\mytab{MLCC capacitor\\ \SI{16}{\volt} \SI{0.1}{\micro\farad} X7R}
& 0603 & C0603C104J4RAC
\\ \addlinespace
3 & C6, C11, C12 &
\mytab{Capacitor electrolítico\\ \SI{16}{\volt} \SI{100}{\micro\farad}}
& Radial Leaded & ULD1C101MED1TD
\\ \addlinespace
1 & C14 &
\mytab{MLCC Capacitor\\ \SI{25}{\volt} \SI{1}{\micro\farad} X7R}
& 0805 & C0805C105J3RACTU
\\ \addlinespace
2 & R29, R30 & Resistencia SMD 10R 1/2W & 1210 & RC1210JR-0710RL
\\ \addlinespace
1 & R25 & Resistencia SMD 1/8W 100k & 0805 & RC0805DR-07100KL
\\ \addlinespace
1 & R26 & Resistencia SMD 1/8W 47k & 0805 & RT0805BRD0747KL
\\ \addlinespace
1 & R41 & Resistencia SMD 1/8W 20k & 0805 & AT0805BRD0720KL
\\ \addlinespace
1 & D11 & TVS Diodes 600W 5.0V & SMB & SMBJ5.0A-TR
\\ \addlinespace
1 & J1, J2 &
\mytab{CONN HEADER VERT\\ 3POS \SI{2.54}{\milli\meter}}
& Through Hole &
\mytab{SWR25X-NRTC-\\ S03-ST-BA}
\\ \addlinespace
1 & U2 & Op Amps Dual 2.7V & SOIC-8 & MCP602-I/SN
\\ \addlinespace
3 & JP1, JP2, JP5 &
\mytab{2.54mm Hdr 3P Single\\ Str Gold} & Straight Pin
& \mytab{Pin: 61300311121\\ Jumper: 382811-8} \\ \addlinespace
1 & U1 & Analog Dual Comparators & SOIC-8 & LM393MX/NOPB
\\ \addlinespace
1 & J3 &
\mytab{CONN HEADER VERT\\ 4POS \SI{2.54}{\milli\meter}}
& Through Hole &
\mytab{SWR25X-NRTC-\\ S04-ST-BA}
\\ \addlinespace
2 & R19, R22, R27 &
\mytab{Resistencia SMD\\ 1/8W 100R} & 0805 & AT0805DRD07100RL
\\ \addlinespace
1 & Microcontrolador &
\mytab{Development Boards \& \\Kits -- ARM STM32} & - & NUCLEO-L432KC
\\ \addlinespace
1 & U3 &
\mytab{LVDS Interface IC\\ Single Full-Duplex} & SOIC-8 150mil & SN65LVDS179DR
\\ \addlinespace
1 & C8 &
\mytab{MLCC Capacitor\\ \SI{10}{\volt} \SI{1000}{\pico\farad}} & 0402 & C0402C102J8RACTU
\\ \addlinespace
1 & U5 &
\mytab{Ethernet Connectors\\ Female 8P Vertical} & Through Hole & 615008138021
\\ \addlinespace
1 & C17 &
\mytab{MLCC Capacitor\\
\SI{16}{\volt} \SI{1}{\micro\farad} X7R} & 0603 &
\mytab{C0603X105M4-\\RACAUTO} \\
\end{longtable}
\endgroup
\end{document}