
Я считаю, что это очень простой вопрос, на который может быть очень простой ответ, который я пока не смог найти: Как можно принудительно набрать текст для каждого элемента в обычном LaTeX2e
списке (например, ) как полностью строчные буквы? Моя проблема с этим заключается в том, что или команды требуют аргумента с разделителем, чего нет в случае , поскольку он работает как управляющая последовательность. Моя мотивация: иногда мне хотелось бы, чтобы текст в списке элементов был набран малыми заглавными буквами, и чтобы все символы соответствовали высоте строчных букв, но мне хотелось бы иметь возможность сделать это без необходимости использовать указанные выше команды наenumerate
\lowercase
\MakeLowercase
\item
руководствопоэлементно. Самый тривиальный ответ (просто введите текст строчными буквами) не является полезным ответом, поскольку я хотел бы иметь возможность использовать тот же текст, без необходимости перепечатывать его, как обычный \upshape
текст.
EDIT: Я отметил предложение А. Эллетта как ответ на основе его функциональности, соответствующей моему вопросу, и потому что я считаю его достойным и очень хорошо продуманным вкладом на его собственных условиях. Тем не менее, более простой подход, если он возможен, все равно приветствовался бы.
решение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
не будет сначала установлено в нижнем регистре.