
나는 이것이 지금까지 찾을 수 없었던 매우 간단한 대답이 있을 수 있는 매우 간단한 질문이라고 믿습니다. 일반 목록 LaTeX2e
(예: enumerate
) 내의 각 항목에 대한 텍스트를 어떻게 강제로 다음과 같이 조판할 수 있습니까? 모두 소문자? 내 문제는 \lowercase
또는 구분된 인수가 필요한 명령이라는 것입니다 . 이는 제어 시퀀스로 작동하기 때문에 \MakeLowercase
의 경우에는 해당되지 않습니다 . \item
내 동기: 때로는 항목 목록의 텍스트를 작은 대문자로 조판하고 모든 문자의 높이가 소문자에 해당하도록 하고 싶지만, 필요 없이 그렇게 할 수 있기를 바랍니다. 위의 명령을 사용하려면수동품목별로. 가장 사소한 답변(모두 소문자로 텍스트를 입력하기만 하면 됨)은 유용한 답변이 되지 않습니다. 동일한 텍스트를 다시 입력할 필요 없이 일반 \upshape
텍스트로 사용할 수 있기를 원하기 때문입니다.
편집: 나는 A. Ellett의 제안을 내 질문에 맞는 기능을 기반으로 하고 그 자체로 가치 있고 매우 잘 고려된 기여라고 생각하기 때문에 답변으로 선택했습니다. 그럼에도 불구하고, 가능하다면 더 간단한 접근 방식이 여전히 환영받을 것입니다.
답변1
이 업데이트된 버전(이전 버전의 개정 기록 참조)에서는 사용자가 환경에 기능을 추가할 필요가 없습니다. 그럴 필요도 없고 \item*
그런 것도 없습니다. 이것은 \item
첫 번째 반복 에서 밀수입을 통해 가능해졌습니다 .이동(재정의다시) \item
. 귀하의 필요에 맞게 이 코드를 수정할 수 있도록 광범위한 설명을 추가했습니다.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\makeatletter
%% We will use two versions for redefining \item
%% The first version is temporary and only used
%% for the first iteration. It's purpose is to
%% allow us to slip in an \item just before the
%% environment is ended.
\def\@ae@item@va@#1\item#2\@nil{%%
\def\item##1\end{\@ae@item@vb@##1\@nil}%%
\@ae@item@vb@#1\item#2\@nil}
\def\@ae@item@vb@#1\item#2\@nil{%%
%% Don't immediately pass to \olditem
%% we need to see whether there's any optional
%% arguments being passed to \item
\ae@olditem #1\@nil%%
%% If second argument is empty, then that means
%% we've parsed the entire environment and should
%% quit. Restore the "\end" we stole earlier.
\if\relax\detokenize{#2}\relax
\expandafter\end
\else
%% We don't want to get too deeply buried within
%% \if...\fi structures. So save #2 to a macro
%% then call a dummy macro, but only after first
%% leaving the \if...\fi structure.
\def\ae@tmp{#2}%%
\expandafter\@@ae@continue@iterating@item
\fi}
%% Test whether there's an optional argument.
\def\ae@olditem{%%
\@ifnextchar[%]
{\@o@ae@olditem}
{\@@ae@olditem}}
\def\@o@ae@olditem[#1]{\olditem[#1] \@@ae@@format}
\def\@@ae@olditem{\olditem \@@ae@@format}
%% The actual formatting of the content following \item
\def\@@ae@@format#1\@nil{%%
\bgroup\scshape\lowercase{#1}\egroup}
%% The macro handling the continuation of iterating over
%% the \item's in the environment. Notice the use of
%% \expandafter. We don't want to pass the formatting
%% macro content buried into a temporary macro. Remember
%% the \ae@tmp was only used to help us jump out of the
%% \if ... \fi structure.
\def\@@ae@continue@iterating@item{%%
\expandafter\item\ae@tmp\end}
\newenvironment{mylc}
{%%
\begin{enumerate}
\let\olditem\item
%% new definition for \item but only good for first iteration.
%% This is how we smuggle in a final \item
%% just before ending the environment. Here we
%% also steal the `\end` which closes the environment.
%% We'll have to restore that before we're done.
\def\item##1\end{%%
\@ae@item@va@##1\item\@nil}
}
{\end{enumerate}}
\makeatother
\def\aerandomstuff{A random string of stuff.}
\begin{document}
\begin{mylc}
\item `A' is for Amy who\ldots
\item[<optional argument>] This line has an optional argument.
\item
\item The previous item was empty, but that won't cause us to
prematurely terminate.
\item Matter buried in a macro will not be handled correctly: \aerandomstuff
\item This is the last line. No special mark up needed.
\end{mylc}
\end{document}
확장 문제 관련: \lowercase
확장된 콘텐츠에서만 작동합니다. 나처럼 밀수입된 것은 \aerandomstuff
먼저 소문자로 설정되지 않습니다.