
Creo que esta es una pregunta muy simple para la cual puede haber una respuesta muy simple que hasta ahora no he podido encontrar: ¿Cómo se puede forzar que el texto de cada elemento dentro de una LaTeX2e
lista normal (como enumerate
) se escriba como ¿todo en minúsculas? Mi problema con esto es que los comandos \lowercase
or \MakeLowercase
requieren un argumento delimitado, lo cual no es el caso con un \item
, ya que funciona como una secuencia de control. Mi motivación: a veces me gustaría tener el texto en una lista de elementos para escribirlo en versalitas y tener todos los caracteres correspondientes a las alturas en minúsculas, pero me gustaría poder hacerlo sin tener que para usar los comandos anteriores en unmanualpor artículo. La respuesta más trivial (simplemente ingrese el texto en minúsculas) no es una respuesta útil, ya que me gustaría poder usar el mismo texto, sin necesidad de volver a escribirlo, como \upshape
texto normal.
EDITAR: He marcado la propuesta de A. Ellett como respuesta debido a que su funcionalidad se ajusta a mi pregunta y porque la considero una contribución valiosa y muy bien pensada en sus propios términos. No obstante, aún sería bienvenido un enfoque más simple, si fuera factible.
Respuesta1
Esta versión actualizada (consulte el historial de revisiones para versiones anteriores) no requiere que el usuario agregue ninguna característica a su entorno. No es necesario \item*
ni nada de eso. Esto es posible mediante el contrabando en \item
la primera iteración y luegocambiando(redefiniendode nuevo) \item
. Agregué comentarios extensos que deberían permitirle modificar este código para adaptarlo mejor a sus necesidades.
\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}
Respecto a cuestiones de expansión: El \lowercase
único funciona con contenido ampliado. Todo lo que entre de contrabando, como hago yo, \aerandomstuff
no se pondrá primero en minúsculas.