
Mi pregunta podría ser similar a esta.La lista de elementos dentro de la celda de la tabla no está bien alineada., pero la solución no encajaba en mi caso.
con este código:
\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}
Esto resultó en esto[salida1][ ]1[
]2
Mis preguntas son:
- Sé que con \newlist y \setlist puedo crear una lista enumerada personalizada en la primera columna, pero ¿hay alguna forma más elegante?
answered
- ¿Cómo puedo producir una tabla que abarque varias páginas con una combinación de lista numerada en la primera columna, algo de texto en la segunda columna,
:
símbolo en la tercera columna y lista numerada en la cuarta columna y mantenerlas alineadas verticalmente? - ¿Y cómo puedo reducir el espacio vertical innecesario entre \section y el texto posterior?
answered
Cualquier ayuda sería muy apreciada.
Respuesta1
Si la única razón para utilizar un entorno personalizado enumerate
es insertar automáticamente un contador en la primera columna, le sugiero que proceda de la siguiente manera. Observe que tanto el entorno longtable
como el tabular
cuentan con una columna (de tipo N
) que se programa para incrementar el contador y luego imprimirlo inmediatamente.
Tenga en cuenta que se pueden hacer fácilmente referencias cruzadas de filas específicas mediante el \label
mecanismo habitual \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}