表格中的 LaTeX 对齐

表格中的 LaTeX 对齐

我正在尝试创建一个使用表格来对齐某些内容的自定义环境。我希望第一列左对齐,所以我使用了命令\tabularx{\textwidth}{ l X c X }。这在第一个上产生了预期的结果\item,但其余的\item都是右对齐的。我做错了什么?

我有一个自定义类文件instructions.cls

% Formal Instructions format

\NeedsTeXFormat{LaTeX2e}
\LoadClass[10pt]{scrartcl}
\ProvidesClass{instructions}
              [2015/02/26 v1.0 Technical Instructions]

\RequirePackage[hmargin=0.5in,vmargin=0.5in]{geometry}
\RequirePackage{tabularx}
\RequirePackage{hyperref}

\hypersetup{
    bookmarks=true
}

\newcounter{StepListCounter}

\newenvironment{steplist} {
    \medskip
    \setcounter{StepListCounter}{1}
    \renewcommand\item[2]{
        \medskip
        {\textbf{\arabic{StepListCounter}}} & ##1 & & ##2 \\
        \stepcounter{StepListCounter}
    }

    \tabularx{\textwidth}{ r X c X }
} {
    \endtabularx
    \medskip
}

我的 tex 文件instructions.tex

\documentclass{instructions}

\begin{document}

\section*{Preparing the Parachute}

In this section, you will untangle the parachute and prepare it for the process of packing.

\begin{steplist}
    \item{Set the harness/container system on the ground with the shoulder
        harness toward the ground.}{}
    \item{Place the weight on the ground at the top of the harness.}{}
    \item{Place the rear lines in your right hand and the front lines in your
        left hand.}{}
    \item{Walk toward the parachute with the lines in your hand.}{}
    \item{Shake the parachute left \& right to remove as many creases as
        possible.}{}
\end{steplist}

\section*{Folding the Parachute}

These steps will guide you through organizing and folding the parachute so that
it can fit into the D-Bag and properly deploy.

\section*{Packing the Parachute in the D-Bag}

In the following section, you will will pack the folded parachute into the
D-Bag.

\section*{Securing the Lines}

In these steps, you will secure the lines to the straps on the outside of the D-Bag.

\section*{Packing the D-Bag in the Container}

You will pack the D-Bag into the container, keeping the lines organized so they
do not tangle.

\section*{Closing the Container}

In the following steps, you will be guided through closing the container around
the D-Bag so that it does not open prematurely.

\end{document}

渲染效果如下:

图片

答案1

在重新安置部分线路后,

\documentclass{Article}
\usepackage{tabularx}
\newcounter{StepListCounter}
\renewcommand\item[2]{%
        \medskip\noindent
        {\textbf{\arabic{StepListCounter}}\stepcounter{StepListCounter}} & #1 & & #2 \\
    }
\newenvironment{steplist} {%
    \medskip
    \setcounter{StepListCounter}{1}%
    \tabularx{\textwidth}{l X c X }
} {
    \endtabularx
    \medskip
}
\begin{document}
\begin{steplist}
    \item{Set the harness/container system on the ground with the shoulder
        harness toward the ground.}{}
    \item{Place the weight on the ground at the top of the harness.}{}
    \item{Place the rear lines in your right hand and the front lines in your
        left hand.}{}
    \item{Walk toward the parachute with the lines in your hand.}{}
    \item{Shake the parachute left \& right to remove as many creases as
        possible.}{}
\end{steplist}
\end{document}

在此处输入图片描述

相关内容