.png)
다중 열을 사용하여 표의 첫 번째 행을 중앙에 배치하고 나머지는 일반 단락 규칙을 따르도록 했습니다. 코드 조각은 다음과 같습니다.
\documentclass[a4paper,12pt]{report}
\usepackage{indentfirst}
\setlength{\parindent}{2.30em}
\usepackage[utf8]{inputenc}
\usepackage{pdflscape}
\usepackage{lscape}
\usepackage{booktabs, tabularx}
\usepackage{bm}
\usepackage{xfrac}
\usepackage[titles]{tocloft}
\usepackage{subfig}
\usepackage{rotating}
\usepackage{wrapfig}
\usepackage{mathptmx}
\usepackage{amsmath, amssymb, amsfonts}
\usepackage{cleveref}
\usepackage[top=1.8in, bottom=1.25in, left=1.75in, right=1.25in, headheight=1.25in]{geometry}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
\sloppy
\microtypecontext{spacing=nonfrench}
\emergencystretch=\maxdimen
% Fonts
\usepackage{sectsty}
\allsectionsfont{\normalsize}
%Pagination
\usepackage{fancyhdr}
\pagestyle{fancyplain}% <- use fancyplain instead fancy
\fancyhf{}
\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
% Caption
\usepackage{caption}
\captionsetup{format=hang, font=normalsize, labelfont=bf, justification=justified, labelsep=period}
% Graphics
\usepackage{graphicx}
\graphicspath{{./Figure/}}
\DeclareGraphicsExtensions{.pdf,.jpeg,.jpg,.png}
% Spacing
\usepackage{setspace} % control linespacing
\setstretch{1.5}
\clearpage
\begin{document}
\renewcommand{\thechapter}{\Roman{chapter}}
\chapter{Methodology}
\renewcommand{\thechapter}{\arabic{chapter}}
\label{ch:Methodology}
\thispagestyle{empty}
\begin{landscape}
\centering
\begin{tabularx}{\linewidth}{| p{0.75in} | p{1in} | p{0.9in} | p{2in} | p{0.8in} | p{0.6in} | p{0.8in} |}{\hyphenpenalty=20\exhyphenpenalty=20}
\hline
\multicolumn{1}{|c|}{\textbf{Name}} & \multicolumn{1}{|c|}{\textbf{Alphanumeric Name}} & \multicolumn{1}{|c|}{\textbf{Fiber Strand Size}} (mm) &
\multicolumn{1}{|c|}{\textbf{Color}} & \multicolumn{1}{|c|}{\textbf{Stripping}} & \multicolumn{1}{|c|}{\textbf{Texture}} &
\multicolumn{1}{|c|}{\textbf{Extracted From}} \\
\hline
Streaky Two & S2 & 0.20 - 0.50 & Ivory white, slightly tinged with very light brown to red or purple streak & Excellent & Soft &
Next to the outer leafsheath \\
\hline
\end{tabularx}
\label{table:Abaca Fiber Grades}
\end{landscape}
\end{document}
그러나 줄에 다음과 같은 오류가 발생합니다 \end{tabularx}
.
해당 오류를 어떻게 제거합니까? 오류가 무엇을 말하려는지 이해가 되지 않습니다. 귀하의 도움에 감사드립니다. 감사합니다!
답변1
A tabularx
형 테이블~ 해야 하다X
테이블의 전체 너비가 대상 너비와 같을 수 있도록 최소한 하나의 -type 열이 있어야 합니다 . 또한 래퍼에 모든 헤더 셀을 넣기 때문에 \multicolumn{1}{c}
실제로 헤더 셀에서 줄 바꿈을 비활성화하여 테이블이 너무 넓어집니다. 내 조언은 래퍼를 사용하지 말고 사용하지 않는 것입니다.굵은 글씨어느 하나. 아, 그리고 꼭 제거하세요 {\hyphenpenalty=20\exhyphenpenalty=20}
.
나는 또한 모든 수직 규칙을 없애고 적절한 간격의 수평 규칙을 사용하여 테이블에 더욱 개방적이고 매력적인 "모양"을 제공하도록 권장하고 싶습니다. 감옥 창과 개방적이고 매력적인 모습을 비교하려면 다음 스크린샷을 확인하세요.
\documentclass[a4paper,12pt]{report}
\usepackage{indentfirst}
\setlength{\parindent}{2.30em} % that's kind of extreme
%\usepackage[utf8]{inputenc} % that's the default nowadays
\usepackage{pdflscape}
%\usepackage{lscape} %% don't load both lscape and pdflscape
\usepackage{booktabs} % for well-spaced horizontal rules
\usepackage{tabularx}
\usepackage{bm}
\usepackage{xfrac}
\usepackage[titles]{tocloft}
\usepackage{subfig}
%%\usepackage{rotating} %% do you need this package?
\usepackage{wrapfig}
\usepackage{amsmath, amssymb} % 'amsfonts' is loaded automatically by 'amssymb'
%\usepackage{mathptmx} % mathptmx is borderline obsolete
\usepackage{newtxtext,newtxmath}
\usepackage{cleveref}
\usepackage[top=1.8in, bottom=1.25in,
left=1.75in, right=1.25in,
headheight=1.25in % this seems excessive
]{geometry}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
\microtypecontext{spacing=nonfrench}
%%\sloppy %% <-- a bad idea
%%\emergencystretch=\maxdimen
% Modify styles of sectioning headers
\usepackage{sectsty}
\allsectionsfont{\normalsize}
%Apperance of pages
\usepackage{fancyhdr}
\pagestyle{fancyplain}% <- use fancyplain instead fancy
\fancyhf{}
\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
% Caption
\usepackage{caption}
\captionsetup{format=hang,
font=normalsize,
labelfont=bf,
justification=justified,
labelsep=period,
skip=0.333\baselineskip}
% Graphics
\usepackage{graphicx}
\graphicspath{{./Figure/}}
\DeclareGraphicsExtensions{.pdf,.jpeg,.jpg,.png}
% Spacing
\usepackage{setspace} % control linespacing
\setstretch{1.5}
%%\clearpage % <-- not needed
%% New
\usepackage{ragged2e} % for '\RaggedRight' macro
\newcolumntype{P}[1]{>{\RaggedRight}p{#1}} % get rid of full justification, allow hyphenation
\newcolumntype{L}{>{\RaggedRight}X} % ditto
\usepackage{calc} % for '\widthof' macro
\begin{document}
% \renewcommand{\thechapter}{\Roman{chapter}}
% \chapter{Methodology}
% \label{ch:Methodology}
%
% \renewcommand{\thechapter}{\arabic{chapter}}
%
% \thispagestyle{empty}
\begin{landscape}
%%\centering % no need for this
\begin{table}
\caption{Abaca Fiber Grades}
\label{table:Abaca_Fiber_Grades}
\begin{tabularx}{\linewidth}%
{| P{\widthof{Streaky Two}} |
P{\widthof{Alphanumeric}} |
P{\widthof{Fiber strand}} |
L |
P{\widthof{Excellent}} |
P{\widthof{Texture}} |
P{1.1in} |}
%\hyphenpenalty=20\exhyphenpenalty=20 % huh??
\hline
Name &
Alphanumeric name &
Fiber strand size (mm) &
Color &
Stripping & % 'Stripping' or 'Striping'?
Texture &
Extracted from \\
\hline
Streaky Two &
S2 &
0.20--0.50 &
Ivory white, slightly tinged with very light brown to red or purple streak &
Excellent &
Soft &
Next to the outer leafsheath \\
\hline
\end{tabularx}
\vspace*{1.5cm}
\caption{Same table, but (i) without vertical rules and (ii) with well-spaced horizontal rules}
\begin{tabularx}{\linewidth}%
{@{} P{\widthof{Streaky Two}}
P{\widthof{Alphanumeric}}
P{\widthof{Fiber strand}}
L
P{\widthof{Excellent}}
P{\widthof{Texture}}
P{1.1in} @{}}
%\hyphenpenalty=20\exhyphenpenalty=20 % huh?
\toprule
Name &
Alphanumeric name &
Fiber strand size (mm) &
Color &
Stripping & % 'Stripping' or 'Striping'?
Texture &
Extracted from \\
\midrule
Streaky Two &
S2 &
0.20--0.50 &
Ivory white, slightly tinged with very light brown to red or purple streak &
Excellent &
Soft &
Next to the outer leafsheath \\
\bottomrule
\end{tabularx}
\end{table}
\end{landscape}
\end{document}