刪除枚舉環境中一行或一段的縮排

刪除枚舉環境中一行或一段的縮排

請參閱螢幕截圖中的藍色框。我有一個段落裡面一個枚舉。我想刪除它的縮進,以便該段落將在沒有縮進的情況下向左對齊。

藍框

下面是我的工作程式碼:

\documentclass[12pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in,footskip=0.25in]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathptmx}
\linespread{1.1}
\usepackage{graphicx}
\usepackage{enumitem}

\usepackage{caption}
\title{\textbf{CHECKLISTS}}
\author{}
\date{}
\begin{document}
    \maketitle
    This is a paragraph before the enumeration. This is a paragraph before the enumeration. This is a paragraph before the enumeration. This is a paragraph before the enumeration. This is a paragraph before the enumeration. \par
    \noindent\rule{\textwidth}{1pt}
    \begin{enumerate}
        \item First line. First line. First line. First line. First line. First line. First line. First line. 
        \item Second line. Second line. Second line. Second line. Second line. Second line. Second line. 
        \item Third line. Third line. Third line. Third line. Third line. Third line. Third line. Third line. Third line. 
        
        This is a paragraph \textbf{WITHIN the enumeration}. This is a paragraph \textbf{WITHIN the enumeration}. This is a paragraph \textbf{WITHIN the enumeration}. This is a paragraph \textbf{WITHIN the enumeration}.
        

        \item Fourth line. Fourth line. Fourth line. Fourth line. Fourth line. Fourth line. Fourth line. 
    \end{enumerate}

    The enumeration has ended here.\par
    \noindent\rule{\textwidth}{1pt}

    This is a new story. This is a new story. This is a new story. This is a new story. This is a new story. This is a new story. This is a new story. This is a new story. 
\end{document}

答案1

在我看來,視覺/美學問題是由於左側表格比0.5\linewidth.一旦您為minipage環境分配了更合適的相對寬度(例如,0.65\linewidth並且0.35\linewidth),環境內部和外部的表格佈局之間的差異enumerate就不那麼明顯了。

無論如何,除非你的桌子空間嚴重受限(這裡不是這種情況),否則我會不是擾亂了環境的佈局enumerate

另外,請透過擺脫大量的\multicolumn{1}{|l|}{...}\multicolumn{1}{l|}{...}包裝並擺脫“外部”tabular環境來簡化您的表格。透過使用較少但間隔良好的水平線,使表格具有更開放的“外觀”,這也可能是一個好主意。有關一些具體的編碼建議,請參閱以下螢幕截圖和程式碼。

在此輸入影像描述

\documentclass[12pt,letterpaper]{article}
%\usepackage[utf8]{inputenc} % that's the default nowadays
\usepackage[margin=1in,footskip=0.25in]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{mathptmx}
%\linespread{1.1}
\usepackage{setspace} \setstretch{1.1}
\usepackage{parskip} % zero \parindent, non-zero \parskip

\usepackage{enumerate} % I'd use 'enumitem' package
\usepackage{caption}
\captionsetup[table]{textfont=bf}
\usepackage{booktabs}

\begin{document}

\rule{\linewidth}{1pt}

\begin{enumerate}
\item First line. First line. First line. First line. First line. First line. First line. First line. 
\item Second line. Second line. Second line. Second line. Second line. Second line. Second line. 
\item Third line. Third line. Third line. Third line. Third line. Third line. Third line. Third line.

% Table 1       
\begin{minipage}[t]{0.65\linewidth}
\captionof{table}{Major Losses from 2020 to 2023}
\centering
\begin{tabular}{@{}llr@{}}
\toprule
    Year & Bets & \multicolumn{1}{l}{Loss} \\
\midrule
    2020 & AMZN, AAPL, GOOG, META  & \$12,067 \\ 
    2021 & PFE, T                  & \$10,559 \\ 
    2022 & LULU                    & \$10,565 \\ 
    2023 & BABA, C, WFC            & \$14,390 \\ 
\midrule[\heavyrulewidth]
& \multicolumn{1}{r}{\textbf{Total}} & \textbf{\$42,581}                       
\end{tabular}
\end{minipage}%
%
% Table 2           
\begin{minipage}[t]{.35\linewidth}
\captionof{table}{Largest Losses}
\centering
\begin{tabular}{@{}lr@{}}
    \toprule
    Company & \multicolumn{1}{l}{Loss} \\ 
    \midrule
    BABA    & \$11,410 \\ 
    X       & \$11,854 \\ 
    D       & \$11,879 \\ 
    MU      & \$12,565 \\ 
    OUST    & \$8,752  \\ 
    MSFT    & \$3,804  \\ 
    \midrule[\heavyrulewidth]
    \multicolumn{1}{r}{\textbf{Total}} & \textbf{\$60,264}        
\end{tabular}
\end{minipage}

\item Fourth line. Fourth line. Fourth line. Fourth line. Fourth line. Fourth line. Fourth line. 

\end{enumerate}

The enumeration ends here.

\rule{\linewidth}{1pt}

This is a new story. This is a new story. This is a new story. This is a new story. 
This is a new story. This is a new story. This is a new story. This is a new story. 

\begin{center}
% Table 3       
\begin{minipage}[t]{0.65\linewidth}
\captionof{table}{Major Losses from 2020 to 2023}
\centering
\begin{tabular}{@{}llr@{}}
\toprule
    Year & Bets & \multicolumn{1}{l}{Loss}    \\
\midrule
    2020 & AMZN, AAPL, GOOG, META  & \$12,067 \\ 
    2021 & PFE, T                  & \$10,559 \\ 
    2022 & LULU                    & \$10,565 \\ 
    2023 & BABA, C, WFC            & \$14,390 \\ 
\midrule[\heavyrulewidth]
& \multicolumn{1}{r}{\textbf{Total}} & \textbf{\$42,581}                       
\end{tabular}
\end{minipage}%
%
% Table 4           
\begin{minipage}[t]{.35\linewidth}
\captionof{table}{Largest Losses}
\centering
\begin{tabular}{@{}lr@{}}
    \toprule
    Company & \multicolumn{1}{l}{Loss} \\ 
    \midrule
    BABA    & \$11,410 \\ 
    X       & \$11,854 \\ 
    D       & \$11,879 \\ 
    MU      & \$12,565 \\ 
    OUST    & \$8,752  \\ 
    MSFT    & \$3,804  \\ 
    \midrule[\heavyrulewidth]
    \multicolumn{1}{r}{\textbf{Total}} & \textbf{\$60,264}        
\end{tabular}
\end{minipage}

\end{center}

\rule{\linewidth}{1pt}

\end{document}

附錄為了解決OP修改後的問題,即。,

我想要的只是刪除段落枚舉中的縮排。

為此,(a)確保enumitem載入包就足夠了-就像OP發布的修改後的查詢中的情況一樣,(b)插入

\end{enumerate}

就在之前

This is a paragraph \textbf{WITHIN the enumeration}. 
This is a paragraph \textbf{WITHIN the enumeration}. 
This is a paragraph \textbf{WITHIN the enumeration}. 
This is a paragraph \textbf{WITHIN the enumeration}.

(c) 插入

\begin{enumerate}[resume]

立即地該段落,而且也在下一\item指令之前。

答案2

從考試課偷來的想法。

\documentclass[12pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in,footskip=0.25in]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathptmx}
\linespread{1.1}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{caption}

\makeatletter
\newcommand{\fullwidth}[1]{% #1 = text
  \par\hspace*{-\@totalleftmargin}\parbox{\textwidth}{\strut #1\strut}\par}
\makeatother

\title{\textbf{CHECKLISTS}}
\author{}
\date{}
\begin{document}
    \maketitle
    This is a paragraph before the enumeration. This is a paragraph before the enumeration. This is a paragraph before the enumeration. This is a paragraph before the enumeration. This is a paragraph before the enumeration. \par
    \noindent\rule{\textwidth}{1pt}
    \begin{enumerate}
        \item First line. First line. First line. First line. First line. First line. First line. First line. 
        \item Second line. Second line. Second line. Second line. Second line. Second line. Second line. 
        \item Third line. Third line. Third line. Third line. Third line. Third line. Third line. Third line. Third line. 
        
\fullwidth{This is a paragraph \textbf{WITHIN the enumeration}. This is a paragraph \textbf{WITHIN the enumeration}. This is a paragraph \textbf{WITHIN the enumeration}. This is a paragraph \textbf{WITHIN the enumeration}.}
        

        \item Fourth line. Fourth line. Fourth line. Fourth line. Fourth line. Fourth line. Fourth line. 
    \end{enumerate}

    The enumeration has ended here.\par
    \noindent\rule{\textwidth}{1pt}

    This is a new story. This is a new story. This is a new story. This is a new story. This is a new story. This is a new story. This is a new story. This is a new story. 
\end{document}

相關內容