上面是我的代码生成的表格。而我需要像下面第二张图那样的表格。我搜索了很多,但找不到任何解决方案。有人能帮忙吗?我的代码是
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{relsize}
\usepackage{rotating}
\usepackage{lscape}
\usepackage{changepage}
\usepackage{geometry}
\usepackage{makecell}
\usepackage[utf8]{inputenc}
\geometry{legalpaper, landscape, margin=0.2in}
\begin{document}
%\begin{adjustwidth}{-8cm}{}
%\begin{landscape}
\renewcommand{\arraystretch}{1.5}
\renewcommand{\tabcolsep}{1mm}
\begin{table}
\begin{tabular}{|l|l|l|l|}
\hline
\textbf{Event}&\textbf{Destination state}&\textbf{Trans. rate}&\textbf{Condition}\\\hline
1. $PU$ AR. A vacant channel exists in the NCRN.&$(i_{n}+1,j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f)$&$\lambda_P$&At least one vacant channel exists in the NCRN;$B_n(x)< M-R(x)$\\\hline
2. $PU$ AR. No vacant channel exists in the NCRN.$SU_{2N}$ terminates&$(i_{n}+1,j_{n1},j_{n2}-1,i_{r},j_{r1},j_{r2},f)$&$\lambda_P$&$B_n(x)=M– R(x); j_{n2} > 0$\\\hline
3. $PU$ AR. No vacant channel exists in the NCRN.$SU_{1N}$ performs HO to the RCRN.&$(i_{n}+1,j_{n1}-1,j_{n2},i_{r},j_{r1}+1,j_{r2},f)$&$\lambda_P$&$B_n(x) = M – R(x); j_{n2}=0; j_{n1} > 0: B_r(x) < R(x)$\\\hline
4. $PU$ AR. An $SU_{1N}$ terminates.&$(i_{n}+1,j_{n1}-1,j_{n2},i_{r},j_{r1},j_{r2},f)$&$\lambda_P$&$B_n(x) = M – R(x); j_{n2}=j_{r2}=0; j_{n1} > 0; B(x)=M$\\\hline
5. $SU_{1N}$ AR. A vacant channel exists in the NCRN.&$(i_{n},j_{n1}+1,j_{n2},i_{r},j_{r1},j_{r2},f)$&$\lambda_S$&$B_n(x) < M – R(x); B(x) < M$\\\hline
6. $SU_{1N}$ AR. No vacant channel exists in the NCRN. $SU_{2N}$ terminates.&$(i_{n},j_{n1}+1,j_{n2}-1,i_{r},j_{r1},j_{r2},f)$&$\lambda_S$&$B_n(x)=M – R(x); j_{n2} > 0$\\\hline
7. $SU_{2N}$ AR. A vacant channel exists in NCRN&$(i_{n},j_{n1},j_{n2}+1,i_{r},j_{r1},j_{r2},f)$&$\lambda_S$&$B_n(x) < M – R(x)$\\\hline
8. $SU_{2N}$ AR. No vacant channel exists in NCRN. Vacant channel exists in RCRN.&$(i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2}+1,f)$&$\lambda_S$&$B_n(x)=M – R(x); B_r(x) < R(x)$\\\hline
9. $PU$ DP from the NCRN.&$(i_{n}-1,j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f)$&$i_n\;\mu_P$&There is at least one $PU$ service in the NCRN; $i_n>0$.\\\hline
10. $PU$ DP from the RCRN.&$(i_{n},j_{n1},j_{n2},i_{r}-1,j_{r1},j_{r2},f)$&$i_r\;\mu_P$&$Ir > 0$\\\hline
11. $SU_{1N}$ DP from the NCRN.&$(i_{n},j_{n1}-1,j_{n2},i_{r},j_{r1},j_{r2},f)$&$J_{n1}\;\mu_S$&$j_{n1} > 0$\\\hline
12. $SU_{1N}$ DP from the RCRN. &$(i_{n},j_{n1},j_{n2},i_{r},j_{r1}-1,j_{r2},f)$&$j_{r1}\;\mu_S$&$Jr > 0$\\\hline
13. $SU_{2N}$ DP from the NCRN.&$(i_{n},j_{n1},j_{n2}-1,i_{r},j_{r1},j_{r2},f)$&$ j_{n2}\;\mu_S$&$ j_{n2} > 0$\\\hline
14. $SU_{2N}$ DP from the RCRN.&$(i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2}-1,f)$&$j_{r1}\;\mu_S$&$j_{r1} > 0$\\\hline
15. Idle channel failure.&$(i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f+1)$&$(M-B(x))\;\lambda_F$&There is at least one idle channel in the CRN; $B(x) < M$\\\hline
16. An occupied channel fails. An idle channel exists in the CRN.&$(in,j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f+1)$&$(B(x)-f)\;\lambda_F$&$F<B(x)<M$ \\\hline
17. An occupied channel fails. No idle channels exist in the CRN. An $SU_{1N}$ terminates. &$(i_{n}+1,j_{n1}-1,j_{n2},i_{r},j_{r1},j_{r2},f+1)$&$(M-f)\;\lambda_F$&$B(x) = M; j_{n1}>0;j_{n2}=j_{r2}=0$\\\hline
18. An occupied channel fails. No idle channels exist in the CRN. An $SU_{2N}$ terminates.&$ (i_{n}+1,j_{n1},j_{n2}-1,i_{r},j_{r1},j_{r2},f+1)$&$(M-f)\;\lambda_F$&$B(x)=M; j_{n2} > 0$\\\hline
19. An occupied channel fails. No idle channels exist in the CRN. A $PU_{N}$ terminates&$ (i_{n}-1,j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f+1)$&$
(M-f)\;\lambda_F$&$B(x) = M; j_{n1}= j_{n2}=j_{r2}=0; i_{n}>0;$ \\\hline
20. An occupied channel fails. No idle channels exist in the CRN. An $SU_{1R}$ terminates&$ (i_{n},j_{n1},j_{n2},i_{r},j_{r1}-1,j_{r2},f+1)$&$(M-f)\;\lambda_F$&$B(x)=M; B_n(x) = 0; j_{r2}=0; j_{r1}>0; j_{n1}=0;$\\\hline
21. An occupied channel fails. No idle channels exist in the CRN. An $SU_{2R}$ terminates&$ (i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2}-1,f+1)$&$(M-f)\;\lambda_F$&$B(x)=M; B_n(x)=M-R(x); j_{r2} > 0.$ \\\hline
22. An occupied channel fails. No idle channels exist in the CRN. A $PU_R$ terminates&$ (i_{n},j_{n1},j_{n2},i_{r}-1,j_{r1},j_{r2},f+1)$&$(M-f)\;\lambda_F$&$B(x) = M; B_n(x)=j_{r1}=j_{r2}=j_{n2}=0; i_{r}>0$\\\hline
23. A failed channel is repaired&$ (i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f-1)$&$F\;\mu_R$&$f>0$\\\hline
\end{tabular}
\end{table}
\renewcommand{\arraystretch}{1}
\end{document}
答案1
也许你喜欢:
\documentclass[12pt]{article}
\usepackage{geometry}
\geometry{legalpaper, landscape, margin=0.2in}
\usepackage{amsmath,amssymb}
\usepackage{relsize}
\usepackage{rotating}
\usepackage{lscape}
\usepackage{changepage}
\usepackage{booktabs, makecell, tabularx}
%\usepackage[utf8]{inputenc}
\newcounter{tabrow}
\newcolumntype{N}{>{\stepcounter{tabrow}\textbf{\thetabrow}}r}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\begin{document}
\begin{table}
\renewcommand{\arraystretch}{1.1}
% \renewcommand{\tabcolsep}{1mm}
\small
\begin{tabularx}{\linewidth}{N
L
*{2}{>{$}l<{$}}
>{$}L<{$}}
\toprule
\multicolumn{2}{l|}{\textbf{Event}}
& \textbf{Destination state}
& \textbf{Trans. rate}
& \textbf{Condition} \\
\midrule
& $PU$ AR. A vacant channel exists in the NCRN.
& (i_{n}+1,j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f)
& \lambda_P & \text{At least one vacant channel exists in the NCRN; } B_n(x)< M-R(x) \\
& $PU$ AR. No vacant channel exists in the NCRN. $SU_{2N}$ terminates
& (i_{n}+1,j_{n1},j_{n2}-1,i_{r},j_{r1},j_{r2},f)
& \lambda_P & B_n(x)=M– R(x); j_{n2} > 0 \\
& $PU$ AR. No vacant channel exists in the NCRN. $SU_{1N}$ performs HO to the RCRN.
& (i_{n}+1,j_{n1}-1,j_{n2},i_{r},j_{r1}+1,j_{r2},f)
& \lambda_P & B_n(x) = M – R(x); j_{n2}=0; j_{n1} > 0: B_r(x) < R(x) \\
& $PU$ AR. An $SU_{1N}$ terminates.
& (i_{n}+1,j_{n1}-1,j_{n2},i_{r},j_{r1},j_{r2},f)
& \lambda_P & B_n(x) = M – R(x); j_{n2}=j_{r2}=0; j_{n1} > 0; B(x)=M \\
& $SU_{1N}$ AR. A vacant channel exists in the NCRN.
& (i_{n},j_{n1}+1,j_{n2},i_{r},j_{r1},j_{r2},f)
& \lambda_S & B_n(x) < M – R(x); B(x) < M \\
& $SU_{1N}$ AR. No vacant channel exists in the NCRN. $SU_{2N}$ terminates.
& (i_{n},j_{n1}+1,j_{n2}-1,i_{r},j_{r1},j_{r2},f)
& \lambda_S & B_n(x)=M – R(x); j_{n2} > 0 \\
& $SU_{2N}$ AR. A vacant channel exists in NCRN
& (i_{n},j_{n1},j_{n2}+1,i_{r},j_{r1},j_{r2},f)
& \lambda_S & B_n(x) < M – R(x) \\
& $SU_{2N}$ AR. No vacant channel exists in NCRN. Vacant channel exists in RCRN.
& (i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2}+1,f)
& \lambda_S & B_n(x)=M – R(x); B_r(x) < R(x) \\
& $PU$ DP from the NCRN.
& (i_{n}-1,j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f)
& i_n\;\mu_P & \text{There is at least one $PU$ service in the NCRN; } i_n>0. \\
& $PU$ DP from the RCRN.
& (i_{n},j_{n1},j_{n2},i_{r}-1,j_{r1},j_{r2},f)
& i_r\;\mu_P & Ir > 0 \\
& $SU_{1N}$ DP from the NCRN.
& (i_{n},j_{n1}-1,j_{n2},i_{r},j_{r1},j_{r2},f)
& J_{n1}\;\mu_S & j_{n1} > 0 \\
& $SU_{1N}$ DP from the RCRN.
& (i_{n},j_{n1},j_{n2},i_{r},j_{r1}-1,j_{r2},f)
& j_{r1}\;\mu_S & Jr > 0 \\
& $SU_{2N}$ DP from the NCRN.
& (i_{n},j_{n1},j_{n2}-1,i_{r},j_{r1},j_{r2},f)
& j_{n2}\;\mu_S & j_{n2} > 0 \\
& $SU_{2N}$ DP from the RCRN.
& (i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2}-1,f)
& j_{r1}\;\mu_S & j_{r1} > 0 \\
& Idle channel failure.
& (i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f+1)
& (M-B(x))\;\lambda_F & \text{There is at least one idle channel in the CRN; } B(x)<M \\
& An occupied channel fails. An idle channel exists in the CRN.
& (in,j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f+1)
& (B(x)-f)\;\lambda_F & F<B(x)<M \\
& An occupied channel fails. No idle channels exist in the CRN. An $SU_{1N}$ terminates.
& (i_{n}+1,j_{n1}-1,j_{n2},i_{r},j_{r1},j_{r2},f+1)
& (M-f)\;\lambda_F & B(x) = M; j_{n1}>0;j_{n2}=j_{r2}=0\\
& An occupied channel fails. No idle channels exist in the CRN. An $SU_{2N}$ terminates.
& (i_{n}+1,j_{n1},j_{n2}-1,i_{r},j_{r1},j_{r2},f+1)
& (M-f)\;\lambda_F & B(x)=M; j_{n2} > 0 \\
& An occupied channel fails. No idle channels exist in the CRN. A $PU_{N}$ terminates
& (i_{n}-1,j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f+1)
& (M-f)\;\lambda_F & B(x) = M; j_{n1}= j_{n2}=j_{r2}=0; i_{n}>0; \\
& An occupied channel fails. No idle channels exist in the CRN. An $SU_{1R}$ terminates
& (i_{n},j_{n1},j_{n2},i_{r},j_{r1}-1,j_{r2},f+1)
& (M-f)\;\lambda_F & B(x)=M; B_n(x) = 0; j_{r2}=0; j_{r1}>0; j_{n1}=0;\\
& An occupied channel fails. No idle channels exist in the CRN. An $SU_{2R}$ terminates
& (i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2}-1,f+1)
& (M-f)\;\lambda_F & B(x)=M; B_n(x)=M-R(x); j_{r2} > 0. \\
& An occupied channel fails. No idle channels exist in the CRN. A $PU_R$ terminates
& (i_{n},j_{n1},j_{n2},i_{r}-1,j_{r1},j_{r2},f+1)
& (M-f)\;\lambda_F & B(x)=M; B_n(x)=j_{r1}=j_{r2}=j_{n2}=0; i_{r}>0\\
& A failed channel is repaired
& (i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f-1)
& F\;\mu_R & f>0 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
使用的是tabularx
,行自动编号,...
答案2
没有太多的变化,我添加了两个包(booktabs 和 array),删除了所有 \hline 命令并更改了表格的定义,如您所见:
\documentclass[10pt]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{relsize}
\usepackage{rotating}
\usepackage{lscape}
\usepackage{changepage}
\usepackage{geometry}
\usepackage{makecell}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}%% <= new
\usepackage{array}%% <= new
\geometry{legalpaper, landscape, margin=0.2in}
\begin{document}
%\begin{adjustwidth}{-8cm}{}
%\begin{landscape}
\renewcommand{\arraystretch}{1.5}
\renewcommand{\tabcolsep}{1mm}
\begin{table}
\begin{tabular}{>{\bfseries}lb{.35\linewidth}@{\hspace{2em}}l@{\hspace{2em}}l@{\hspace{2em}}p{.3\linewidth}}\toprule
\textbf{Event}&\textbf{Destination state}&\textbf{Trans. rate}&\textbf{Condition}\\\midrule
1.& $PU$ AR. A vacant channel exists in the NCRN.&$(i_{n}+1,j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f)$&$\lambda_P$&At least one vacant channel exists in the NCRN;$B_n(x)< M-R(x)$\\
2.& $PU$ AR. No vacant channel exists in the NCRN.$SU_{2N}$ terminates&$(i_{n}+1,j_{n1},j_{n2}-1,i_{r},j_{r1},j_{r2},f)$&$\lambda_P$&$B_n(x)=M– R(x); j_{n2} > 0$\\
3.& $PU$ AR. No vacant channel exists in the NCRN.$SU_{1N}$ performs HO to the RCRN.&$(i_{n}+1,j_{n1}-1,j_{n2},i_{r},j_{r1}+1,j_{r2},f)$&$\lambda_P$&$B_n(x) = M – R(x); j_{n2}=0; j_{n1} > 0: B_r(x) < R(x)$\\
4.& $PU$ AR. An $SU_{1N}$ terminates.&$(i_{n}+1,j_{n1}-1,j_{n2},i_{r},j_{r1},j_{r2},f)$&$\lambda_P$&$B_n(x) = M – R(x); j_{n2}=j_{r2}=0; j_{n1} > 0; B(x)=M$\\
5.&$SU_{1N}$ AR. A vacant channel exists in the NCRN.&$(i_{n},j_{n1}+1,j_{n2},i_{r},j_{r1},j_{r2},f)$&$\lambda_S$&$B_n(x) < M – R(x); B(x) < M$\\
6.& $SU_{1N}$ AR. No vacant channel exists in the NCRN. $SU_{2N}$ terminates.&$(i_{n},j_{n1}+1,j_{n2}-1,i_{r},j_{r1},j_{r2},f)$&$\lambda_S$&$B_n(x)=M – R(x); j_{n2} > 0$\\
7.& $SU_{2N}$ AR. A vacant channel exists in NCRN&$(i_{n},j_{n1},j_{n2}+1,i_{r},j_{r1},j_{r2},f)$&$\lambda_S$&$B_n(x) < M – R(x)$\\
8.& $SU_{2N}$ AR. No vacant channel exists in NCRN. Vacant channel exists in RCRN.&$(i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2}+1,f)$&$\lambda_S$&$B_n(x)=M – R(x); B_r(x) < R(x)$\\
9.& $PU$ DP from the NCRN.&$(i_{n}-1,j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f)$&$i_n\;\mu_P$&There is at least one $PU$ service in the NCRN; $i_n>0$.\\
10.& $PU$ DP from the RCRN.&$(i_{n},j_{n1},j_{n2},i_{r}-1,j_{r1},j_{r2},f)$&$i_r\;\mu_P$&$Ir > 0$\\
11.& $SU_{1N}$ DP from the NCRN.&$(i_{n},j_{n1}-1,j_{n2},i_{r},j_{r1},j_{r2},f)$&$J_{n1}\;\mu_S$&$j_{n1} > 0$\\
12.& $SU_{1N}$ DP from the RCRN. &$(i_{n},j_{n1},j_{n2},i_{r},j_{r1}-1,j_{r2},f)$&$j_{r1}\;\mu_S$&$Jr > 0$\\
13.& $SU_{2N}$ DP from the NCRN.&$(i_{n},j_{n1},j_{n2}-1,i_{r},j_{r1},j_{r2},f)$&$ j_{n2}\;\mu_S$&$ j_{n2} > 0$\\
14.& $SU_{2N}$ DP from the RCRN.&$(i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2}-1,f)$&$j_{r1}\;\mu_S$&$j_{r1} > 0$\\
15.& Idle channel failure.&$(i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f+1)$&$(M-B(x))\;\lambda_F$&There is at least one idle channel in the CRN; $B(x) < M$\\
16.& An occupied channel fails. An idle channel exists in the CRN.&$(in,j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f+1)$&$(B(x)-f)\;\lambda_F$&$F<B(x)<M$ \\
17.& An occupied channel fails. No idle channels exist in the CRN. An $SU_{1N}$ terminates. &$(i_{n}+1,j_{n1}-1,j_{n2},i_{r},j_{r1},j_{r2},f+1)$&$(M-f)\;\lambda_F$&$B(x) = M; j_{n1}>0;j_{n2}=j_{r2}=0$\\
18.& An occupied channel fails. No idle channels exist in the CRN. An $SU_{2N}$ terminates.&$ (i_{n}+1,j_{n1},j_{n2}-1,i_{r},j_{r1},j_{r2},f+1)$&$(M-f)\;\lambda_F$&$B(x)=M; j_{n2} > 0$\\
19.& An occupied channel fails. No idle channels exist in the CRN. A $PU_{N}$ terminates&$ (i_{n}-1,j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f+1)$&$
(M-f)\;\lambda_F$&$B(x) = M; j_{n1}= j_{n2}=j_{r2}=0; i_{n}>0;$ \\
20.& An occupied channel fails. No idle channels exist in the CRN. An $SU_{1R}$ terminates&$ (i_{n},j_{n1},j_{n2},i_{r},j_{r1}-1,j_{r2},f+1)$&$(M-f)\;\lambda_F$&$B(x)=M; B_n(x) = 0; j_{r2}=0; j_{r1}>0; j_{n1}=0;$\\
21.& An occupied channel fails. No idle channels exist in the CRN. An $SU_{2R}$ terminates&$ (i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2}-1,f+1)$&$(M-f)\;\lambda_F$&$B(x)=M; B_n(x)=M-R(x); j_{r2} > 0.$ \\
22.& An occupied channel fails. No idle channels exist in the CRN. A $PU_R$ terminates&$ (i_{n},j_{n1},j_{n2},i_{r}-1,j_{r1},j_{r2},f+1)$&$(M-f)\;\lambda_F$&$B(x) = M; B_n(x)=j_{r1}=j_{r2}=j_{n2}=0; i_{r}>0$\\
23.& A failed channel is repaired&$ (i_{n},j_{n1},j_{n2},i_{r},j_{r1},j_{r2},f-1)$&$F\;\mu_R$&$f>0$\\\bottomrule
\end{tabular}
\end{table}
\renewcommand{\arraystretch}{1}
\end{document}
好吧,如果我不将字体大小减小到 10 pt,它将无法放在一页中。原因是您的行数比示例图片中多了一些。
要获得粗体数字,您必须将每个数字都加粗。最好有一个粗体打印列,因此我添加了第一列,其中的数字为\bfseries
。
看起来像这样: