![我正在尝试用浅红色突出显示特定行](https://linux22.com/image/311837/%E6%88%91%E6%AD%A3%E5%9C%A8%E5%B0%9D%E8%AF%95%E7%94%A8%E6%B5%85%E7%BA%A2%E8%89%B2%E7%AA%81%E5%87%BA%E6%98%BE%E7%A4%BA%E7%89%B9%E5%AE%9A%E8%A1%8C.png)
我有下表:
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{pdflscape}
\usepackage{longtable}
\begin{document}
\begin{landscape}
\begin{longtable}{ r *{7}{l} }
\caption{Amplified Genes in Claudin-Low Breast Cancer}\label{tab:genes}\\
\hline
& Gene & Description & Cytoband & Chr & Start & End & qValue \\
\hline
\endfirsthead
\multicolumn{8}{c}{Table \ref{tab:genes}, continued}\\[1ex]
\hline
& Gene & Description & Cytoband & Chr & Start & End & qValue \\
\hline
\endhead
\hline
\multicolumn{8}{r@{}}{(continued on next page)}
\endfoot
\hline\hline
\endlastfoot
1 & A26B1 & protein expressed in prostate, ovary, testis, & 15q11.2 & 15 & 19305252 & 19336667 & 0.0093683 \\
2 & APOD & apolipoprotein D precursor & 3q29 & 3 & 196776864 & 196792278 & 1.0584e-06 \\
3 & BEST3 & vitelliform macular dystrophy 2-like 3 isoform & 12q15 & 12 & 68333655 & 68379463 & 0.025626 \\
4 & BTNL3 & butyrophilin-like 3 & 5q35.3 & 5 & 180348506 & 180366333 & 0.15359 \\
5 & BTNL8 & butyrophilin-like 8 long form & 5q35.3 & 5 & 180258734 & 180310512 & 0.15359 \\
6 & BTNL8 & butyrophilin-like 8 short form & 5q35.3 & 5 & 180258764 & 180310512 & 0.15359 \\
7 & CCT2 & chaperonin containing TCP1, subunit 2 & 12q15 & 12 & 68265474 & 68281624 & 0.025626 \\
8 & CDC73 & parafibromin & 1q31.2 & 1 & 191357783 & 191487679 & 4.7334e-13 \\
9 & CNOT2 & CCR4-NOT transcription complex, subunit 2 & 12q15 & 12 & 68923043 & 69035040 & 0.025626 \\
10 & COMT & catechol-O-methyltransferase isoform MB-COMT & 22q11.21 & 22 & 18309308 & 18336530 & 0.063937 \\
11 & COMT & catechol-O-methyltransferase isoform S-COMT & 22q11.21 & 22 & 18330069 & 18336530 & 0.063937 \\
12 & CORO7 & coronin 7 & 16p13.3 & 16 & 4344543 & 4406640 & 0.0061408 \\
13 & CPM & carboxypeptidase M precursor & 12q15 & 12 & 67531222 & 67613246 & 0.025626 \\
14 & CPSF6 & cleavage and polyadenylation specific factor 6, & 12q15 & 12 & 67919583 & 67954405 & 0.025626 \\
15 & DDT & D-dopaome tautomerase & 22q11.23 & 22 & 22643553 & 22646680 & 0.049111 \\
16 & DDTL & D-dopaome tautomerase-like & 22q11.23 & 22 & 22639025 & 22644748 & 0.049111 \\
17 & DNAJA3 & DnaJ (Hsp40) homolog, subfamily A, member 3 & 16p13.3 & 16 & 4415882 & 4446776 & 0.0061408 \\
18 & DOK6 & docking protein 6 & 18q22.2 & 18 & 65219270 & 65660359 & 0.0002252 \\
19 & DUSP10 & dual specificity phosphatase 10 isoform a & 1q41 & 1 & 219941388 & 219982084 & 2.6646e-06 \\
20 & DUSP10 & dual specificity phosphatase 10 isoform b & 1q41 & 1 & 219941388 & 219977425 & 2.6646e-06 \\
21 & ERBB2 & erbB-2 isoform b & 17q12 & 17 & 35097918 & 35138441 & 3.6688e-18 \\
22 & ERBB2 & erbB-2 isoform a & 17q12 & 17 & 35109779 & 35138441 & 3.6688e-18 \\
23 & ERG & v-ets erythroblastosis virus E26 oncogene like & 21q22.2 & 21 & 38675670 & 38955488 & 0.010591 \\
24 & ERLIN2 & ER lipid raft associated 2 isoform 1 & 8p12 & 8 & 37713254 & 37734477 & 4.2319e-21 \\
25 & ERLIN2 & ER lipid raft associated 2 isoform 2 & 8p12 & 8 & 37713356 & 37723229 & 4.2319e-21 \\
26 & FLJ20433 & hypothetical protein LOC54932 & 9q34.3 & 9 & 139321168 & 139437535 & 0.022611 \\
27 & FLJ39743 & hypothetical protein LOC283777 & 15q26.3 & 15 & 96797913 & 96875134 & 0.071718 \\
28 & FLT3 & fms-related tyrosine kinase 3 & 13q12.2 & 13 & 27475410 & 27572729 & 0.0054575 \\
29 & FOXP4 & forkhead box P4 isoform 2 & 6p21.1 & 6 & 41622141 & 41678100 & 0.022611 \\
30 & FOXP4 & forkhead box P4 isoform 1 & 6p21.1 & 6 & 41622141 & 41678100 & 0.022611 \\
31 & FOXP4 & forkhead box P4 isoform 3 & 6p21.1 & 6 & 41622141 & 41678100 & 0.022611 \\
32 & FRS2 & fibroblast growth factor receptor substrate 2 & 12q15 & 12 & 68150395 & 68259829 & 0.025626 \\
33 & GAB1 & GRB2-associated binding protein 1 isoform a & 4q31.21 & 4 & 144477499 & 144610729 & 0.001173 \\
34 & GAB1 & GRB2-associated binding protein 1 isoform b & 4q31.21 & 4 & 144477499 & 144610729 & 0.001173 \\
35 & GSTT2 & glutathione S-transferase theta 2 & 22q11.23 & 22 & 22629600 & 22633393 & 0.049111 \\
36 & GSTT2B & glutathione S-transferase theta 2B & 22q11.23 & 22 & 22629600 & 22633368 & 0.049111 \\
37 & hsa-mir-570 & hsa-mir-570 & 3q29 & 3 & 196911451 & 196911548 & 1.0584e-06 \\
38 & IGF1R & insulin-like growth factor 1 receptor precursor & 15q26.3 & 15 & 97010283 & 97325282 & 0.071718 \\
39 & KCNMB4 & calcium-activated potassium channel beta 4 & 12q15 & 12 & 69046328 & 69111245 & 0.025626 \\
40 & KIT & v-kit Hardy-Zuckerman 4 feline sarcoma viral & 4q12 & 4 & 55218851 & 55301638 & 0.020895 \\
41 & LANCL2 & LanC lantibiotic synthetase component C-like 2 & 7p11.2 & 7 & 55400634 & 55468929 & 0.08329 \\
42 & LOC145814 & hypothetical protein LOC145814 & 15q26.3 & 15 & 97329031 & 97366314 & 0.071718 \\
43 & LOC283755 & hypothetical protein LOC283755 & 15q11.2 & 15 & 18848557 & 18971443 & 0.0093683 \\
44 & LOC283767 & hypothetical protein LOC283767 & 15q11.2 & 15 & 20287609 & 20296164 & 0.0093683 \\
45 & LOC646227 & hypothetical protein LOC646227 & 5q35.3 & 5 & 180341823 & 180345858 & 0.15359 \\
46 & LOC650137 & seven transmembrane helix receptor & 15q11.2 & 15 & 19915065 & 19915749 & 0.0093683 \\
47 & LRRC10 & leucine rich repeat containing 10 & 12q15 & 12 & 68288611 & 68291209 & 0.025626 \\
48 & LYZ & lysozyme precursor & 12q15 & 12 & 68028400 & 68034280 & 0.025626 \\
49 & Magmas & mitochondria-associated granulocyte macrophage & 16p13.3 & 16 & 4330252 & 4341301 & 0.0061408 \\
50 & MDFI & MyoD family inhibitor & 6p21.1 & 6 & 41714230 & 41729959 & 0.022611 \\
51 & MUC20 & mucin 20 isoform S & 3q29 & 3 & 196936768 & 196950211 & 1.0584e-06 \\
52 & MUC20 & mucin 20 isoform L & 3q29 & 3 & 196933423 & 196950211 & 1.0584e-06 \\
53 & NACA2 & nascent-polypeptide-associated complex alpha & 17q23.2 & 17 & 57022571 & 57023345 & 2.4899e-11 \\
54 & OR11H12 & olfactory receptor, family 11, subfamily H, & 14q11.1 & 14 & 18447593 & 18448574 & 0.015 \\
55 & OR4M2 & olfactory receptor, family 4, subfamily M, & 15q11.2 & 15 & 19869939 & 19870881 & 0.0093683 \\
56 & OR4N4 & olfactory receptor, family 4, subfamily N, & 15q11.2 & 15 & 19883836 & 19884787 & 0.0093683 \\
57 & PGC & progastricsin (pepsinogen C) & 6p21.1 & 6 & 41812429 & 41823099 & 0.022611 \\
58 & PIK3CA & phosphoinositide-3-kinase, catalytic, alpha & 3q26.32 & 3 & 180349004 & 180435191 & 0.0015206 \\
59 & PLXNC1 & plexin C1 & 12q22 & 12 & 93066629 & 93223356 & 0.034353 \\
60 & PTK2 & PTK2 protein tyrosine kinase 2 isoform b & 8q24.3 & 8 & 141737682 & 142080514 & 5.1411e-21 \\
61 & PTK2 & PTK2 protein tyrosine kinase 2 isoform a & 8q24.3 & 8 & 141737682 & 142080514 & 5.1411e-21 \\
62 & PTPRB & protein tyrosine phosphatase, receptor type, B & 12q15 & 12 & 69196898 & 69317486 & 0.025626 \\
63 & PTPRD & protein tyrosine phosphatase, receptor type, D & 9p23 & 9 & 8304245 & 10602509 & 0.04362 \\
64 & PTPRR & protein tyrosine phosphatase, receptor type, R & 12q15 & 12 & 69318128 & 69600851 & 0.025626 \\
65 & RAB3IP & RAB3A interacting protein isoform A & 12q15 & 12 & 68459020 & 68503251 & 0.025626 \\
66 & RAB3IP & RAB3A interacting protein isoform beta 1 & 12q15 & 12 & 68418897 & 68503251 & 0.025626 \\
67 & RAB3IP & RAB3A interacting protein isoform alpha 1 & 12q15 & 12 & 68418897 & 68503251 & 0.025626 \\
68 & RAB3IP & RAB3A interacting protein isoform beta 2 & 12q15 & 12 & 68419446 & 68503251 & 0.025626 \\
69 & RAB3IP & RAB3A interacting protein isoform alpha 2 & 12q15 & 12 & 68419446 & 68503251 & 0.025626 \\
70 & RB1 & retinoblastoma 1 & 13q14.2 & 13 & 47775883 & 47954027 & 0.11977 \\
71 & RET & ret proto-oncogene isoform c & 10q11.21 & 10 & 42892522 & 42942958 & 0.0038256 \\
72 & RET & ret proto-oncogene isoform a & 10q11.21 & 10 & 42892522 & 42945803 & 0.0038256 \\
73 & TFEB & transcription factor EB & 6p21.1 & 6 & 41759693 & 41810776 & 0.022611 \\
74 & TMPRSS11E & transmembrane protease, serine 11E & 4q13.2 & 4 & 68995761 & 69045917 & 7.5131e-06 \\
75 & TMPRSS11E2 & transmembrane protease, serine 11E2 & 4q13.2 & 4 & 68995761 & 69045917 & 7.5131e-06 \\
76 & UGT2B15 & UDP glycosyltransferase 2 family, polypeptide & 4q13.2 & 4 & 69194909 & 69218969 & 7.5131e-06 \\
77 & UGT2B17 & UDP glucuronosyltransferase 2 family, & 4q13.2 & 4 & 69085497 & 69116840 & 7.5131e-06 \\
78 & VASN & slit-like 2 & 16p13.3 & 16 & 4361849 & 4373530 & 0.0061408 \\
79 & YEATS4 & glioma-amplified sequence-41 & 12q15 & 12 & 68039798 & 68070843 & 0.025626 \\
80 & ZDHHC11 & zinc finger, DHHC-type containing 11 & 5p15.33 & 5 & 848721 & 904101 & 0.0080506 \\
81 & ZNF709 & zinc finger protein 709 & 19p13.2 & 19 & 12435742 & 12456632 & 1.98e-08 \\
\hline
\hline
\end{longtable}
\end{landscape}
\clearpage
\begin{landscape}
\begin{longtable}{ r *{7}{l} }
\caption{Deleted Genes in Claudin-low Breast Cancer}\label{tab:genes}\\
\hline
& Gene & Description & Cytoband & Chr & Start & End & qValue \\
\hline
\endfirsthead
\multicolumn{8}{c}{Table \ref{tab:genes}, continued}\\[1ex]
\hline
& Gene & Description & Cytoband & Chr & Start & End & qValue \\
\hline
\endhead
\hline
\multicolumn{8}{r@{}}{(continued on next page)}
\endfoot
\hline\hline
\endlastfoot
\clearpage
\begin{landscape}
\begin{longtable}{ r *{7}{l} }
\caption{Simultaneously Amplified or Deleted Genes in Claudin-Low Breast Cancer}\label{tab:genes}\\
\hline
& Gene & Description & Cytoband & Chr & Start & End \\
\hline
\endfirsthead
\multicolumn{8}{c}{Table \ref{tab:genes}, continued}\\[1ex]
\hline
& Gene & Description & Cytoband & Chr & Start & End & qValue \\
\hline
\endhead
\hline
\multicolumn{8}{r@{}}{(continued on next page)}
\endfoot
\hline\hline
\endlastfoot
1 & A26B1 & protein expressed in prostate, ovary, testis, & 15q11.2 & 15 & 19305252 & 19336667 \\
2 & APOD & apolipoprotein D precursor & 3q29 & 3 & 196776864 & 196792278 \\
3 & DOK6 & docking protein 6 & 18q23 & 18 & 65219270 & 65660359 \\
4 & FLJ20433 & hypothetical protein LOC54932 & 9q34.3 & 9 & 139321168 & 139437535 \\
5 & FLT3 & fms-related tyrosine kinase 3 & 13q12.2 & 13 & 27475410 & 27572729 \\
6 & hsa-mir-570 & hsa-mir-570 & 3q29 & 3 & 196911451 & 196911548 \\
7 & LOC283755 & hypothetical protein LOC283755 & 15q11.2 & 15 & 18848557 & 18971443 \\
8 & LOC283767 & hypothetical protein LOC283767 & 15q11.2 & 15 & 20287609 & 20296164 \\
9 & LOC650137 & seven transmembrane helix receptor & 15q11.2 & 15 & 19915065 & 19915749 \\
10 & MUC20 & mucin 20 isoform L & 3q29 & 3 & 196933423 & 196950211 \\
11 & MUC20 & mucin 20 isoform S & 3q29 & 3 & 196936768 & 196950211 \\
12 & OR11H12 & olfactory receptor, family 11, subfamily H, & 14q11.1 & 14 & 18447593 & 18448574 \\
13 & OR4M2 & olfactory receptor, family 4, subfamily M, & 15q11.2 & 15 & 19869939 & 19870881 \\
14 & OR4N4 & olfactory receptor, family 4, subfamily N, & 15q11.2 & 15 & 19883836 & 19884787 \\
15 & PIK3CA & phosphoinositide-3-kinase, catalytic, alpha & 3q26.32 & 3 & 180349004 & 180435191 \\
16 & TMPRSS11E & transmembrane protease, serine 11E & 4q13.2.1 & 4 & 68995761 & 69045917 \\
17 & TMPRSS11E2 & transmembrane protease, serine 11E2 & 4q13.2.1 & 4 & 68995761 & 69045917 \\
18 & UGT2B15 & UDP glycosyltransferase 2 family, polypeptide & 4q13.2.1 & 4 & 69194909 & 69218969 \\
19 & UGT2B17 & UDP glucuronosyltransferase 2 family, & 4q13.2.1 & 4 & 69085497 & 69116840 \\
20 & ZDHHC11 & zinc finger, DHHC-type containing 11 & 5p15.33 & 5 & 848721 & 904101 \\
\hline
\hline
\end{longtable}
\end{landscape}
\end{document}
我想用漂亮的淡红色突出显示第 4-6 行和第 21 行。可以吗?谢谢!
答案1
装入包\usepackage[table]{xcolor}
,然后\rowcolor{red!50}
在您想要着色的行前添加(或减少数字以使其更浅)。
关于这一点的一点说明(由 Amar 建议):该\rowcolor{}
命令来自colortbl
包(正如 David Carlisle 在他的评论中提到的那样)。它不是来自xcolor
提供自己的 \rowcolors 或 rowcolors* 命令的包。要使用它们,必须使用xcolor
可选参数加载包table
。当以这种方式加载时,可选的 table 参数也会调用加载 colortbl 包,这就是该命令起作用的原因。
无论如何,这是一个例子:
\rowcolor{red!50}
4 & BTNL3 & butyrophilin-like 3 & 5q35.3 & 5 & 180348506 & 180366333 & 0.15359 \\
这会在规则所在位置产生小白线。据我所知,没有(简单)方法可以去除它。
您还可以通过将其添加到包选项中来以横向方式呈现文档geometry
。
答案2
您必须加载\usepackage[usenames,dvipsnames,table]{xcolor}
包,然后定义自定义颜色,比如 -\definecolor{indianred1}{RGB}{255,106,106}
并使用包\rowcolors*[<commands>]{<row>}{<odd-row color>}{<even-row color>}
中的命令xcolor
以及选择\showrowcolors
和\hiderowcolors
取消选择有颜色和没有颜色的行。
注意:请参阅xcolor
(v2.11 2007/01/21)文档第 28 页以了解更多信息。
梅威瑟:
\documentclass[11pt,a4paper]{article}
\usepackage[usenames,dvipsnames,table]{xcolor}
\usepackage{graphicx}
\definecolor{indianred1}{RGB}{255,106,106} % New colour definition for printing pale red colour!
\begin{document}
I would like to \colorbox{indianred1}{highlight rows 4-6} and 21 with \colorbox{indianred1}{a nice pale red color.} Is it possible? % --- uses "graphicx" package
\vspace*{2em}
{ % Begin group --- % To keep the effect local!
\renewcommand*{\arraystretch}{1.2} % to increase space between rows!
\hspace*{\fill}
\rowcolors*{3}{indianred1}{indianred1} % --- uses "xcolor" package
\begin{tabular}{c c c}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
1 & 2 & 3 \\
\hiderowcolors 4 & 5 & 6 \\
\showrowcolors 7 & 8 & 9 \\
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
1 & 2 & 3 \\
\hiderowcolors 4 & 5 & 6 \\
7 & 8 & 9 \\
1 & 2 & 3 \\
4 & 5 & 6 \\
\showrowcolors 7 & 8 & 9 \\
\end{tabular}
\hspace*{\fill}
} % End group --- % To keep the effect local!
\end{document}
输出: