㡣
这家伙很懒,什么也没写!

注册于 2年前

回答
5
文章
0
关注者
0

不知道是不是模板自带的Makefile导致的原因,将必要的cls, tex等文件单独拿出来编译后,这个问题已经得到解决。

已解决,使用 \ifcase#1 即可。

下面是正确代码

\documentclass{article}

\newcounter{numexm}[section]
\setcounter{numexm}{0}
\renewcommand\thenumexm{\roman{numexm}}

\newcounter{first}
\setcounter{first}{2}

\newenvironment{ntexmC}[5][0]{
    \newcommand\makechoice{%
        \ifcase#1%
        \relax\or %
        A. #2 \hfill B. #3 \hfill
        C. #4 \hfill D. #5\or %
        A. #2\hfill B. #3\hspace{\stretch{3}} \par
        C. #4\hfill D. #5\hspace{\stretch{3}}\or %
        A. #2\par B. #3\par C. #4\par D. #5\else %
        \relax \fi
    }%
    \par\addvspace{.2em}\stepcounter{numexm}
    \setlength\parindent{0em} Example \thenumexm. 
}{\par\makechoice\par\addvspace{.2em}}

\begin{document}
\section{One}
\begin{ntexmC}[1]%
    {AAAAAAA}%
    {BBBBBBB}%
    {CCCCCCC}%
    {DDDDDDD}%
    The title (\hspace{1em})
\end{ntexmC}

\end{document}

另外,使用 \addspace 时,前面需要使用一个 \par

经过测试,并不是 xifthen 宏包的问题。只要为环境设置非空值,就会出现这样的空白。

问题已经解决,和 xifthen 红包无关。是由于

\begin{ntdef}[定义一]
        这是第一条定义
    \end{ntdef}

使用环境时[参数]后面的换行被视作空格导致,两个解决方法,

\begin{ntdef}[定义一]%
        这是第一条定义
    \end{ntdef}

或在环境的前定义末尾加上 \ignorespaces

\newenvironment{ntdef}[1][]{
    \vspace*{.2em}
    \newcommand\makecomment{%
        \ifthenelse{\isempty{#1}}
        {}% if the option is empty
        {1}%
    }
    \newcommand\makedef{\stepcounter{numdef}
        \textit{定义}\ \thesubsection.\thenumdef:
    }
    \noindent\makedef \ignorespaces
}{\par\vspace{.2em}}

谢谢解答,我英语不是特别好,就没有仔细研究文档。但是我一直对 latex 的 inputenc, fontenc 有很多疑惑,看了文档和书感觉还是对它们的概念很模糊。书上还出现了像 OT1,OT2,T1 之类的选项,我在网上没有查到它们到底属于什么。您能解释一下它们在编译中的用途和它们之间的关系吗?

发布
问题