
Acredito que esta seja uma pergunta muito simples para a qual pode haver uma resposta muito simples que até agora não consegui encontrar: Como o texto de cada item de uma LaTeX2e
lista regular (como enumerate
) pode ser forçado a ser digitado como todas as letras minúsculas? Meu problema com isso é que \lowercase
ou \MakeLowercase
são comandos que exigem um argumento delimitado, o que não é o caso de um \item
, pois funciona como uma sequência de controle. Minha motivação: às vezes eu gostaria de ter o texto em uma lista de itens para ser digitado em versalete e ter todos os caracteres correspondentes às alturas minúsculas, mas gostaria de poder fazer isso sem ter para usar os comandos acima em ummanualpor item. A resposta mais trivial (basta inserir o texto em letras minúsculas) não é uma resposta útil, pois gostaria de poder usar o mesmo texto, sem precisar digitá-lo novamente, como \upshape
texto normal.
EDITAR: marquei a proposta de A. Ellett como resposta com base em sua funcionalidade, adequada à minha pergunta e porque penso nela como uma contribuição valiosa e muito bem pensada em seus próprios termos. No entanto, uma abordagem mais simples, se viável, ainda seria bem-vinda.
Responder1
Esta versão atualizada (consulte o histórico de revisões para versões mais antigas) não exige que o usuário adicione nenhum recurso ao seu ambiente. Não há necessidade \item*
nem nada parecido. Isto é possível através do contrabando na \item
primeira iteração e depoismudando(redefinindode novo) \item
. Adicionei comentários extensos que devem permitir que você modifique esse código para melhor atender às suas necessidades.
\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}
Em relação a questões de expansão: O \lowercase
só funciona com conteúdo expandido. Qualquer coisa contrabandeada, como eu faço, \aerandomstuff
não será primeiro colocada em letras minúsculas.