为什么我只能看到一半的文本?请参见下图。我使用环境longtable
并尝试将整个表格涂成一种颜色。
感谢帮助。
\documentclass[10pt,a6paper]{article}
%46paper
\usepackage[utf8]{inputenc}
\usepackage[main=slovak,english]{babel}
\usepackage[cm]{fullpage}
\usepackage[a6paper, top=15mm, left=10mm, right=10mm, bottom=10mm,foot=5mm,marginparsep=0mm]{geometry}
%showframe
\usepackage{tipa}
\usepackage{multirow}
\usepackage{rotating}
\usepackage{graphicx}
\usepackage{array}
\usepackage{color}
\usepackage[dvipsnames]{xcolor}
\usepackage{longtable}
\usepackage{lscape}
\usepackage{xcolor,colortbl}
\usepackage{enumitem}
\usepackage{tabularx,booktabs}
\usepackage{mathtools}
%\pagenumbering{alph}
%\pagenumbering{Roman}
\usepackage{ marvosym }
\usepackage{fontawesome}
\usepackage{tfrupee}
\usepackage{stackengine}
\usepackage{textcomp}
\usepackage{marvosym}
%----------------------------------------------
\usepackage{booktabs,longtable,makecell}
%------------------------------------------------
\usepackage{ wasysym}
\usepackage{textcomp}
\usepackage{tikz}
\usepackage{ amssymb }
\usepackage{amsmath}
%---------------------------------------
%\usepackage{tgbonum}
\usepackage{mathtools}
%\usepackage{color}
\usepackage{listings}
%------------------------------------------
\usepackage{multirow}
\usepackage{ marvosym }
\usepackage{pdflscape}
\usepackage{ wasysym }
\usepackage{framed}
\usepackage{hyperref}
\usepackage{soul}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage{glossaries}
\usepackage{color, colortbl}
%\usepackage[table]{xcolor}
%---
\makeglossaries
%\input{adj_1.txt}
\input{adj_2.txt}
\begin{document}
\catcode`\-=12
\sloppy
\clearpage
%\setcounter{secnumdepth}{0}
%\setcounter{page}{1}
%\tableofcontents
%\thispagestyle{empty}
{\Large
\begin{longtable}{|l|l|l|}
\hline
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} \multirow{2}{*}{txt} & \cellcolor{Goldenrod} \multirow{16}{*}{txt} \\
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} & \cellcolor{Goldenrod} \\ \cline{1-2}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} \multirow{2}{*}{txt} & \cellcolor{Goldenrod} \\ \cline{1-1}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} & \cellcolor{Goldenrod} \\ \cline{1-2}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} \multirow{2}{*}{txt} & \cellcolor{Goldenrod} \\ \cline{1-1}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} & \cellcolor{Goldenrod} \\ \cline{1-2}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} \multirow{2}{*}{txt} & \cellcolor{Goldenrod} \\ \cline{1-1}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} & \cellcolor{Goldenrod} \\ \cline{1-2}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} \multirow{2}{*}{txt} & \cellcolor{Goldenrod} \\ \cline{1-1}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} & \cellcolor{Goldenrod} \\ \cline{1-2}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} \multirow{2}{*}{txt} & \cellcolor{Goldenrod} \\ \cline{1-1}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} & \cellcolor{Goldenrod} \\ \cline{1-2}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} \multirow{2}{*}{txt} & \cellcolor{Goldenrod} \\ \cline{1-1}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} & \cellcolor{Goldenrod} \\ \cline{1-2}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} \multirow{2}{*}{txt} & \cellcolor{Goldenrod} \\ \cline{1-1}
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} & \cellcolor{Goldenrod} \\ \cline{1-1}
\hline
\end{longtable}
}
\end{document}
答案1
你必须把 \multirow
把最后的行,行数为负数。还有一个问题:表格\cline
不会以全厚度显示。一个(不完美的)解决方案是hhline
先使用黑色,然后再使用背景色。此外,您不必cellcolor
在每个单元格中写入:表格\rowcolors
将为xcolor
每行设置背景色。
编辑:感谢@David Carlisle,我解决了垂直线不连续的问题。由于代码相当长,我为这里使用的两种水平线定义了快捷方式:\hhlinebgg
和\hhlinebbg
:
\documentclass[10pt,a6paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[main=slovak,english]{babel}
\usepackage[cm]{fullpage}
\usepackage[a6paper, top=15mm, hmargin=10mm, bottom=10mm,foot=5mm,marginparsep=0mm]{geometry}
%showframe
\usepackage{tipa}
\usepackage{multirow}
\usepackage{rotating}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage{pdflscape}
\usepackage{enumitem}
\usepackage{longtable, tabularx, makecell, multirow, booktabs, hhline}
\usepackage[table, dvipsnames]{xcolor}
\usepackage{mathtools}
%\pagenumbering{alph}
%\pagenumbering{Roman}
\usepackage{ wasysym, marvosym }
\usepackage{fontawesome}
\usepackage{stackengine}
\usepackage{textcomp}
%------------------------------------------------
\usepackage{tikz}
\usepackage{ amssymb }
%---------------------------------------
\usepackage{listings}
\usepackage{framed}
\usepackage{soul}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\def\blackrule{>{\arrayrulecolor{black}}}
\def\goldrule{\expandafter>{\arrayrulecolor{Goldenrod}}}
\newcommand*{\hhlinebgg}{\hhline{->{\arrayrulecolor{Goldenrod}}->{\arrayrulecolor{black}}|>{\arrayrulecolor{Goldenrod}}->{\arrayrulecolor{black}}|}
}
\newcommand*{\hhlinebbg}{\hhline{-->{\arrayrulecolor{Goldenrod}}->{\arrayrulecolor{black}}|}}
\begin{document}
\catcode`\-=12
\sloppy
\clearpage
{\Large
\rowcolors{1}{Goldenrod}{Goldenrod}
\begin{longtable}{|*{3}{l|}}%
\hhline{---}
txt & & \\
\hhlinebgg%
txt & \multirow{-2}{*}{txt} & \\
\hhlinebbg
txt & & \\
\hhlinebgg
txt & \multirow{-2}{*}{txt} & \\
\hhlinebbg
txt & & \\
\hhlinebgg
txt & \multirow{-2}{*}{txt} & \\
\hhlinebbg
txt & & \\
\hhlinebgg
txt & \multirow{-2}{*}{txt} &\\
\hhlinebbg
txt & & \\
\hhlinebgg
txt & \multirow{-2}{*}{txt} & \\
\hhlinebbg
txt & & \\
\hhlinebgg
txt & \multirow{-2}{*}{txt} & \\
\hhlinebbg
txt & & \\
\hhlinebgg
txt & \multirow{-2}{*}{txt} & \\
\hhlinebbg
txt & & \\
\hhlinebgg
txt & \multirow{-2}{*}{txt} & \multirow{-16}{*}{txt}\\
\hhline{---}
\end{longtable}
}
\end{document}
答案2
将多行移到第二行,参见多行文档。然后清理你的前言,你正在两次加载许多包。
\documentclass[10pt,a6paper]{article}
\usepackage[dvipsnames,table]{xcolor}
\usepackage{longtable}
\usepackage{multirow}
\begin{document}
\begin{longtable}{|l|l|l|}
\hline
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} & \cellcolor{Goldenrod} \multirow{16}{*}{txt} \\
\cellcolor{Goldenrod} txt & \cellcolor{Goldenrod} \multirow{-2}{*}{txt} & \cellcolor{Goldenrod} \\ \cline{1-2}
\end{longtable}
\end{document}