
나는 모든 교과 과정의 세부 사항을 포함하는 표를 만들려고 노력하고 있습니다. 다음 코드를 작성했습니다. 여기에는 몇 가지 문제가 있습니다.
- 컴파일 시 첫 번째 페이지가 비어 있는 이유는 무엇입니까(두 번째 페이지에 테이블 포함)?
- 표는 페이지 왼쪽 여백에 공간을 많이 남겨두는 것 같은데, 이를 이용하면 4번째 열을 더 넓게 사용할 수 있는데 그 공간을 활용하지 못하는 것 같습니다.
- 표는 두 번째 페이지 아래쪽에 있는 페이지 번호를 초과하며, 두 번째 페이지에 표시된 내용 이후에는 아무 것도 표시되지 않습니다. 다른 코스가 여러 개 있는데 이 표가 약 3페이지에 걸쳐 있도록 하고 싶습니다. 내가 어떻게 해?
참고: 일부 강사의 실제 이름에는 두 줄이 필요하므로 두 번째 열을 p-열로 만들었습니다.
코드는 다음과 같습니다.
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{p{2.5cm}p{2cm}lp{6cm}}
\toprule[2pt]
Name of Course & Instructor & Book(s) Referred & Brief List of Topics Covered \\
\hline
\\[\defaultaddspace]
Algebra I & ABC & Herstein; M. Artin &
\parbox{6cm}{Basic Set Theory; Group Theory\\(upto Sylow theorems);\\ Introduction to Ring Theory} \\
\\[\defaultaddspace]
Algebra II & DEF & Hoffman and Kunze &
\parbox{6cm}{Linear Algebra \\(upto Spectral theorems)} \\
\\[\defaultaddspace]
Algebra III & GHI & S. Lang &
\parbox{6cm}{Ring and Module Theory\\(covering Hilbert basis theorem and structure theorem for finitely generated abelian groups)}\\
\\[\defaultaddspace]
Algebra IV & JKL & S. Lang &
\parbox{6cm}{Introduction to Field \\ and Galois Theory}\\
\\[\defaultaddspace]
Analysis I & MNO & T. Apostol &
\parbox{6cm}{Real numbers; Sequences and series;\\ Calculus of a single variable \\ (upto Taylor's Theorem)
} \\
\\[\defaultaddspace]
Analysis II & PQR & T. Apostol &
\parbox{6cm}{Riemann integral; Introduction to \\ Calculus of several variables; \\ Metric spaces and elementary \\ topological notions on it} \\
\\[\defaultaddspace]
Analysis III & \parbox{2cm}{STU} & S. Dineen &
\parbox{6cm}{\textbf{Vector Calculus}: multiple integrals, \\ Jacobian formula, line and surface \\ integrals, Green's, Stokes' and Gauss' (Divergence) theorems; \\ Sequences of functions; Weierstrass \\ approximation theorem} \\
\\[\defaultaddspace]
Analysis IV & VWX & Rudin &
\parbox{6cm}{\textbf{Introduction to Function Spaces}:\\ compact metric spaces,\\ C([a,b]) as a complete metric space, \\ Banach's contraction principle, \\ Stone-Weierstrass and Arzela-Ascoli theorems, Fourier series } \\
\\[\defaultaddspace]
Probability Theory I & YZ & Chung; Feller &
\parbox{6cm}{Combinatorial probability and urn models; Conditional probability; \\ Random variables; Expectation; \\ Moment generating functions;\\ Standard distributions(Binomial etc.); \\ Joint and conditional distributions; \\ Weak law of large numbers} \\
\\[\defaultaddspace]
Probability Theory II & YZ & Feller &
\parbox{6cm}{Joint distributions; \\Transformation of variables\\(assuming Jacobian formula);\\ Distributions for sums, maxima/minima, order statistics, etc.; Standard multivariate and sampling distributions; Conditional expectation; Convergence of random variables} \\
\\[\defaultaddspace]
\bottomrule[2pt]
\end{tabular}
\end{document}
답변1
진짜 문제는 페이지에 테이블을 넣을 공간이 충분하지 않다는 것입니다.
이것이 내가 제안하는 것입니다:
테이블을 여러 페이지로 분할하려는 경우
longtable
대신 동일한 패키지에서 사용하십시오 .tabular
이 경우 테이블은 한 페이지에 머물 수 있습니다. 패키지를 사용하여
geometry
테이블이 있는 페이지에 대해서만 페이지 여백을 줄일 수 있습니다.\newgeometry{margin=2cm}
나중에 발행하여 일반 레이아웃을 복원하십시오.
\restoregeometry
\defaultaddspace
~ 의 길이를 줄이세요1pt
\setlength{\defaultaddspace}{1pt}
\parbox
셀 내용을 중앙에 배치하기 위해 es를 사용할 필요가 없습니다 . 대신 패키지를 로드하여array
사용할 수 있습니다 . 새로운 열 유형을 선언할 수도 있습니다.m
p
M
\newcolumntype{M}[1]{>{\raggedright\arraybackslash}m{#1}}
\newline
셀 내부에서 줄 바꿈을 실행하는 데 사용할 수도 있습니다 .
완전한 예:
\documentclass[a4paper,10pt]{article}
\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsthm,array}
\usepackage{booktabs}
\usepackage{array,longtable}
\usepackage{lipsum} %only for the example
\newcolumntype{M}[1]{>{\raggedright\arraybackslash}m{#1}}
\setlength{\defaultaddspace}{1pt}
\begin{document}
\lipsum[1-5]
\newpage
\newgeometry{margin=2cm}
\begin{longtable}{p{2.5cm}p{2cm}lM{6cm}}
\toprule[2pt]
Name of Course & Instructor & Book(s) Referred & Brief List of Topics Covered \\
\hline
\\[\defaultaddspace]
Algebra I & ABC & Herstein; M. Artin &
Basic Set Theory; Group Theory\newline(upto Sylow theorems);\newline Introduction to Ring Theory \\
\\[\defaultaddspace]
Algebra II & DEF & Hoffman and Kunze &
Linear Algebra \newline(upto Spectral theorems) \\
\\[\defaultaddspace]
Algebra III & GHI & S. Lang &
Ring and Module Theory\newline(covering Hilbert basis theorem and structure theorem for finitely generated abelian groups) \\
\\[\defaultaddspace]
Algebra IV & JKL & S. Lang &
Introduction to Field \newline and Galois Theory\\
\\[\defaultaddspace]
Analysis I & MNO & T. Apostol &
Real numbers; Sequences and series;\newline Calculus of a single variable \newline (upto Taylor's Theorem) \\
\\[\defaultaddspace]
Analysis II & PQR & T. Apostol &
Riemann integral; Introduction to \newline Calculus of several variables; \newline Metric spaces and elementary \newline topological notions on it \\
\\[\defaultaddspace]
Analysis III & \parbox{2cm}{STU} & S. Dineen &
\textbf{Vector Calculus}: multiple integrals, \newline Jacobian formula, line and surface \newline integrals, Green's, Stokes' and Gauss' (Divergence) theorems; \newline Sequences of functions; Weierstrass \newline approximation theorem \\
\\[\defaultaddspace]
Analysis IV & VWX & Rudin &
\textbf{Introduction to Function Spaces}:\newline compact metric spaces,\newline C([a,b]) as a complete metric space, \newline Banach's contraction principle, \newline Stone-Weierstrass and Arzela-Ascoli theorems, Fourier series \\
\\[\defaultaddspace]
Probability Theory I & YZ & Chung; Feller &
Combinatorial probability and urn models; Conditional probability; \newline Random variables; Expectation; \newline Moment generating functions;\newline Standard distributions(Binomial etc.); \newline Joint and conditional distributions; \newline Weak law of large numbers \\
\\[\defaultaddspace]
Probability Theory II & YZ & Feller &
Joint distributions; \newline Transformation of variables\newline(assuming Jacobian formula);\newline Distributions for sums, maxima/minima, order statistics, etc.; Standard multivariate and sampling distributions; Conditional expectation; Convergence of random variables \\
\\[\defaultaddspace]
\bottomrule[2pt]
\end{longtable}
\newpage
\restoregeometry
\lipsum[1-5]
\end{document}
산출:
편집하다
egreg가 그의 의견에서 언급했듯이 추가 before p
없이 일반 열을 사용하면 테이블이 더 좋아 보일 것입니다 .\\
\\[\defaultaddspace]
이것은 또 다른 가능성입니다(가장 좋아하는 것을 선택하십시오):
\documentclass[a4paper,10pt]{article}
\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsthm,array}
\usepackage{booktabs}
\usepackage{array,longtable}
\usepackage{lipsum} %only for the example
\begin{document}
\lipsum[1-5]
\newpage
\newgeometry{margin=3cm}
\begin{longtable}{p{2.5cm}p{2cm}lp{6cm}}
\toprule[2pt]
Name of Course & Instructor & Book(s) Referred & Brief List of Topics Covered \\[\defaultaddspace]
\hline
\\
Algebra I & ABC & Herstein; M. Artin &
Basic Set Theory; Group Theory\newline(upto Sylow theorems);\newline Introduction to Ring Theory \\[\defaultaddspace]
Algebra II & DEF & Hoffman and Kunze &
Linear Algebra \newline(upto Spectral theorems) \\[\defaultaddspace]
Algebra III & GHI & S. Lang &
Ring and Module Theory\newline(covering Hilbert basis theorem and structure theorem for finitely generated abelian groups) \\[\defaultaddspace]
Algebra IV & JKL & S. Lang &
Introduction to Field \newline and Galois Theory \\[\defaultaddspace]
Analysis I & MNO & T. Apostol &
Real numbers; Sequences and series;\newline Calculus of a single variable \newline (upto Taylor's Theorem) \\[\defaultaddspace]
Analysis II & PQR & T. Apostol &
Riemann integral; Introduction to \newline Calculus of several variables; \newline Metric spaces and elementary \newline topological notions on it \\[\defaultaddspace]
Analysis III & \parbox{2cm}{STU} & S. Dineen &
\textbf{Vector Calculus}: multiple integrals, \newline Jacobian formula, line and surface \newline integrals, Green's, Stokes' and Gauss' (Divergence) theorems; \newline Sequences of functions; Weierstrass \newline approximation theorem \\[\defaultaddspace]
Analysis IV & VWX & Rudin &
\textbf{Introduction to Function Spaces}:\newline compact metric spaces,\newline C([a,b]) as a complete metric space, \newline Banach's contraction principle, \newline Stone-Weierstrass and Arzela-Ascoli theorems, Fourier series \\[\defaultaddspace]
Probability Theory I & YZ & Chung; Feller &
Combinatorial probability and urn models; Conditional probability; \newline Random variables; Expectation; \newline Moment generating functions;\newline Standard distributions(Binomial etc.); \newline Joint and conditional distributions; \newline Weak law of large numbers \\[\defaultaddspace]
Probability Theory II & YZ & Feller &
Joint distributions; \newline Transformation of variables\newline(assuming Jacobian formula);\newline Distributions for sums, maxima/minima, order statistics, etc.; Standard multivariate and sampling distributions; Conditional expectation; Convergence of random variables \\[\defaultaddspace]
\bottomrule[2pt]
\end{longtable}
\newpage
\restoregeometry
\lipsum[1-5]
\end{document}
답변2
한 페이지에 맞는다고 가정하고 테이블에 대해 다음을 수행하는 것이 좋습니다.
tabularx
환경 대신 환경 을 사용tabular
하고 너비를 로 설정하고 최종 열에 열 유형을\textwidth
사용합니다 .X
그러면 마지막 열의 너비가 (\textwidth
다른 세 열의 너비를 뺀 값)로 설정됩니다.마지막 열에서는 전체 정렬 대신 Raggedright 조판을 사용합니다.
ragged2e
Raggedright 모드에서 조판된 단어의 하이픈 넣기를 허용하려면 패키지를 로드하세요 .다양한 래퍼를 제거
\parbox
하고\newline
문을 사용하여 열 4에서 줄 바꿈을 유도합니다. (@egreg에게 감사드립니다!)많은
\\ \\[\defaultaddspace]
지침을\\[\defaultaddspace]
. 에서 제공하는 것보다 더 많은 세로 공백이 필요한 경우\defaultaddspace
해당 매개변수의 값을 적절하게 늘리면 됩니다. 아래 예에서는2.5\defaultaddspace
대수학 및 분석 과정 그룹 뒤에 더 많은 수직 공간을 제공하는 데 사용합니다.
주변 의 여백을 가정하면 1in
다음과 같은 모습을 얻을 수 있습니다.
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amsthm,booktabs}
\usepackage{tabularx,ragged2e}
\newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{@{} l p{1.75cm} l Y @{}}
\toprule[2pt]
Name of Course & Instructor & Book(s) Referred & Brief List of Topics Covered \\
\midrule
Algebra I & ABC & Herstein; M. Artin &
Basic Set Theory; Group Theory\newline
(upto Sylow theorems);\newline
Introduction to Ring Theory \\[\defaultaddspace]
Algebra II & DEF & Hoffman and Kunze &
Linear Algebra \newline
(upto Spectral theorems) \\[\defaultaddspace]
Algebra III & GHI & S. Lang &
Ring and Module Theory \newline
(covering Hilbert basis theorem and structure theorem for finitely generated
abelian groups)\\[\defaultaddspace]
Algebra IV & JKL & S. Lang &
Introduction to Field and Galois Theory \\[2.5\defaultaddspace]
Analysis I & MNO & T. Apostol &
Real numbers; Sequences and series;\newline
Calculus of a single variable \newline
(upto Taylor's Theorem) \\[\defaultaddspace]
Analysis II & PQR & T. Apostol &
Riemann integral; Introduction to Calculus of several variables; \newline
Metric spaces and elementary topological notions on it \\[\defaultaddspace]
Analysis III & STU & S. Dineen &
\textbf{Vector Calculus}: multiple integrals, Jacobian formula, line and
surface integrals, Green's, Stokes' and Gauss' (Divergence) theorems; \newline
Sequences of functions; \newline
Weierstrass approximation theorem \\[\defaultaddspace]
Analysis IV & VWX & Rudin &
\textbf{Introduction to Function Spaces}:\newline
compact metric spaces, $C([a,b])$ as a complete metric space, Banach's contraction principle,
Stone-Weierstrass and Arzela-Ascoli theorems, Fourier series \\[2.5\defaultaddspace]
Prob.\ Theory I & YZ & Chung; Feller &
Combinatorial probability and urn models; Conditional probability; \newline
Random variables; Expectation; \newline
Moment generating functions;\newline
Standard distributions (Binomial etc.); \newline
Joint and conditional distributions; \newline
Weak law of large numbers \\[\defaultaddspace]
Prob.\ Theory II & YZ & Feller &
Joint distributions; \newline
Transformation of variables (assuming Jacobian formula);\newline
Distributions for sums, maxima\slash minima, order statistics, etc.;\newline
Standard multivariate and sampling distributions;\newline
Conditional expectation; \newline
Convergence of random variables \\
\bottomrule[2pt]
\end{tabularx}
\end{document}
부록: 테이블이 여러 페이지에 걸쳐 있을 수 있도록 이 설정을 확장하는 것은 간단합니다. (i) 로드해야 합니다.긴 테이블그리고ltxtable패키지(패키지 외에 tabularx
)를 서문에 포함하고 (ii) 테이블의 머리글/바닥글 구조를 일부 변경하여 다음 구문을 따르도록 합니다 longtable
.
\begin{tabularx}{\textwidth}{...}
현재 테이블( ~\end{tabularx}
) 의 전체 내용을별도의 파일. 이 파일을mybiglongtable.tex
. (좀 더 어울리는 이름을 생각해내실 수 있을 거라 믿습니다...)"드라이버 파일"에 명령을 삽입하십시오.
\LTXtable{\textwidth}{mybiglongtable.tex} % note explicit width indication
바로 테이블이 시작되기를 원하는 곳에서요. (A는
longtable
LaTeX라는 단어 의미에서 "부동 개체"가 아닙니다.) 따라서 이전 단일 페이지 테이블 예제의 드라이버 파일은 다음과 같습니다.\documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage[margin=1in]{geometry} \usepackage{amsmath,amsthm,booktabs} \usepackage{tabularx,longtable,ltxtable,ragged2e} \newcolumntype{Y}{>{\RaggedRight\arraybackslash}X} \begin{document} \LTXtable{\textwidth}{mybiglongtable.tex} \end{document}
파일에서
mybiglongtable.tex
다음과 같이 변경합니다.변화
\begin{tabularx}{\textwidth}{@{} l p{1.75cm} l Y @{}}
에게
\begin{longtable}{@{} l p{1.75cm} l Y @{}} % no explicit width indication
\end{tabularx}
(파일 끝에서) 을\end{longtable}
.구문을 사용하여 다음과 같이
longtable
바로 뒤에 필수 머리글 및 바닥글 정보를 제공합니다 .\begin{longtable}{...}
\toprule[2pt] Name of Course & Instructor & Book(s) Referred & Brief List of Topics Covered \\ \midrule \endfirsthead \multicolumn{4}{@{}l}{\emph{Continued from previous page}}\\ \midrule[\heavyrulewidth] \endhead \midrule[\heavyrulewidth] \multicolumn{4}{r@{}}{\emph{Continued on following page}} \endfoot \bottomrule[2pt] \endlastfoot
테이블 상단과 하단에 대한 모든 규칙 그리기 명령은
\endfirsthead
,\endhead
,\endfoot
및 명령 중 하나에 할당됩니다\endlastfoot
.파일의 나머지 부분(까지
\end{longtable}
)에는 테이블의 "본문", 즉 강좌와 관련된 정보가 포함되어야 합니다. 이전 MWE에서와 같이\\[\defaultaddspace]
및를 사용하여\\[2.5\defaultaddspace]
콘텐츠의 시각적 그룹화를 제공할 수 있습니다.