
私の質問はこれと似ているかもしれない表のセル内の項目リストが適切に配置されていませんしかし、その解決策は私のケースには適合しませんでした。
このコードで:
\documentclass[a4paper, 11pt]{article}
\usepackage[margin=2cm]{geometry} % changes the margin
\usepackage{enumitem}
\usepackage{amssymb}
\usepackage{titlesec}
\usepackage{indentfirst}
\usepackage{longtable}
\usepackage{blindtext}
%% Create a very compact enumerated list environment
\newlist{myenum}{enumerate}{1}
\setlist[myenum]{label=\arabic*., nosep, wide,
leftmargin=*, % hanging indentation
before=\vspace{-0.57\baselineskip},
after =\vspace{-0.8\baselineskip}} % reducing vertical space
%---------------------Need to Simplify This-----------------------------%
\newlist{myenum2}{enumerate}{1}
\setlist[myenum2]{label=\alph*), nosep, wide,
leftmargin=*, % hanging indentation
before=\vspace{-0.57\baselineskip},
after =\vspace{-0.8\baselineskip}} % reducing vertical space
\newlist{myenum3}{enumerate}{1}
\setlist[myenum3]{label=\arabic*), nosep, wide,
leftmargin=*, % hanging indentation
before=\vspace{-0.57\baselineskip},
after =\vspace{-0.8\baselineskip}} % reducing vertical space
\newlist{myenum4}{enumerate}{1}
\setlist[myenum4]{label=\arabic*., nosep, wide,
leftmargin=*, % hanging indentation
before=\vspace{-0.57\baselineskip},
after =\vspace{-0.8\baselineskip},
start=2} % reducing vertical space
\newlist{myenum5}{enumerate}{1}
\setlist[myenum5]{label=\arabic*., nosep, wide,
leftmargin=*, % hanging indentation
before=\vspace{-0.57\baselineskip},
after =\vspace{-0.8\baselineskip},
start=3} % reducing vertical space
\newlist{myenum6}{enumerate}{1}
\setlist[myenum6]{label=\arabic*., nosep, wide,
leftmargin=*, % hanging indentation
before=\vspace{-0.57\baselineskip},
after =\vspace{-0.8\baselineskip},
start=4} % reducing vertical space
\newlist{myenum7}{enumerate}{1}
\setlist[myenum7]{label=\arabic*., nosep, wide,
leftmargin=*, % hanging indentation
before=\vspace{-0.57\baselineskip},
after =\vspace{-0.8\baselineskip},
start=5} % reducing vertical space
\renewcommand\thesection{\Alph{section}.}
\renewcommand\thesubsection{\arabic{subsection}.}
%% Re-format the font size of "the section"
% {11} is the desired font size
% {15} is the vertical spacing, perhaps refers to 1.5 lines?
% \selectfont is for un-bold the sub-section
\titleformat{\section}
{\normalfont\fontsize{11}{.5em}\bfseries}{\thesection}{.5em}
{}
\titleformat{\subsection}
{\normalfont\fontsize{11}{.5em}\selectfont}{\thesubsection}{.5em}
{}
\titlespacing % starred version: first paragraph is not indented
{\subsection} % <command>
{0em} % <left>
{.4em} % <before-sep>
{.3em} % <after-sep>
\setlength\parindent{1cm}
% Avoid hypenation (breaking sentences in paragraph)
\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000
\begin{document}
%------------------------------Section D---------------------------------------------%
\section{Some Text Here}
\begin{longtable}{@{}p{0.3\textwidth}cp{0.65\textwidth}}
%% Subsection 1
\begin{myenum} \item Some Text Here \end{myenum} & : & \blindtext \\
%% Subsection 2
\begin{myenum4} \item Some Text Here \end{myenum4} & : & \blindtext \\
%% Subsection 3
\begin{myenum5} \item Some Text Here \end{myenum5} & : & \begin{myenum3}
\item Some Text Here;
\item Some Text Here;
\item Some Text Here;
\item Some Text Here;
\item Some Text Here;
\item Some Text Here.
\end{myenum3}\\
%% Subsection 4
\begin{myenum6} \item Some Text Here \end{myenum6} & : & \begin{myenum2}
\item \blindtext;
\item \blindtext;
\end{myenum2}\\
%% Subsection 5
\begin{myenum7} \item{Some Text Here} \end{myenum7} & : & \blindtext.\\
\end{longtable}
\end{document}
私の質問は次のとおりです:
- \newlist と \setlist を使用すると、最初の列にカスタマイズされた列挙リストを作成できることは知っていますが、もっとエレガントな方法はありますか?
answered
- 最初の列に番号付きリスト、2 番目の列にテキスト、
:
3 番目の列に記号、4 番目の列に番号付きリストを組み合わせて、垂直方向に揃えた状態で複数ページにまたがる表を作成するにはどうすればよいでしょうか。 - また、\section とその後のテキストの間の不要な垂直スペースを減らすにはどうすればよいでしょうか?
answered
ご協力いただければ幸いです。
答え1
カスタム環境を使用する唯一の理由が、enumerate
最初の列にカウンターを自動的に挿入することである場合は、次のように進めることをお勧めします。環境longtable
と環境の両方に、カウンターを増分してすぐに印刷するようにプログラムtabular
された列 (タイプ) があることに注意してください。N
\label
通常の-\ref
メカニズムを使用して、特定の行を簡単に相互参照できることに注意してください。
\documentclass[a4paper, 11pt]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{array,longtable,etoolbox,lipsum}
\setlength\extrarowheight{2pt} % for a more open "look" of tabular material
\newcolumntype{P}[1]{p{#1\textwidth}}
\newcounter{rownum}
\newcolumntype{N}{>{\refstepcounter{rownum}\therownum}l}
% Automate resetting of counter to 0 at the start of a tabular-like env.:
\AtBeginEnvironment{tabular}{\setcounter{rownum}{0}}
\AtBeginEnvironment{tabular*}{\setcounter{rownum}{0}}
\AtBeginEnvironment{tabularx}{\setcounter{rownum}{0}}
\AtBeginEnvironment{longtable}{\setcounter{rownum}{0}}
\begin{document}
\begingroup % localize the following settings
\setlength\tabcolsep{0pt} % <--- important
\setlength\LTleft{0pt} \setlength\LTright{0pt}
\begin{longtable}{@{\extracolsep{\fill}} N P{0.32} P{0.63}}
% rel. column widths of the "P" columns should sum to no more than 0.95.
\hline
\endfirsthead
\hline
\endlastfoot
& Some text here & \lipsum*[1] \\[1ex]
& Some more text here & \lipsum*[2] \\
\end{longtable}
\endgroup
\begin{center}
\begin{tabular}{@{} N lll @{}}
\hline
& a & b & c \\
& d & e & f \\
\label{row:last}& g & h & i \\
\hline
\end{tabular}
\end{center}
%% Create a cross-reference to the final row:
\noindent
A cross-reference to row \ref{row:last}.
\end{document}