Leer contenido en un entorno particular utilizando solo LaTeX

Leer contenido en un entorno particular utilizando solo LaTeX

Me gustaría encontrar el texto del \begin{thebibliography}....\end{thebibliography}texto del entorno como el ejemplo ------(6 guiones) usando macros LaTeX2e o LaTeX3 y lo mostraré LaTeX GeneriorErroral compilar:

LaTeX filename.tex

Mi MWE es:

\documentclass{article}
        \usepackage{amsmath}
        \usepackage{ragged2e}
        
        \begin{document}
        \title{Book Title}
        \author{Author Name}
        \maketitle
        
    To address these issues, \textit{WordMelodies} a mobile application to support children in the acquisition of basic literacy skills.
    The app was designed to be inclusive for children with and without VIB, thus promoting interaction between them.
    \textit{WordMelodies} also supports children in exercising basic touchscreen interactions on mobile devices.
    
\begin{thebibliography}{}

\bibitem{bib1}
Author N., ``Revisiting the Foundations of Network Analysis,'' {\em Science}, {325},~414--416.

\bibitem{bib2}
``Diagnosing Multicollinearity ------ Random Graph Models,'' {\em Research}, {50},~491--530.

\end{thebibliography}
\end{document}

yo había comprobadoPara leer un archivo LaTeX completo usando macros LaTeX2ey no trabajar en \thebibliographyentornos.

¿Cómo lograr esto?

Respuesta1

No tengo claro si desea generar un error real (de acuerdo con mi intento ciertamente incierto de comprender su pregunta) o si desea incluir algo así LaTeX GenericErroren su salida tipográfica (como sugiere la respuesta vinculada que aceptó). Como ya tienes código para este último, modifiquéla respuesta de cabohahpara proporcionar lo primero.

\documentclass{article}
\usepackage{amsmath}
\usepackage{ragged2e}

% ateb: https://tex.stackexchange.com/a/705721/ addaswyd o ateb cabohah: https://tex.stackexchange.com/a/705318/
\NewEnvironmentCopy{thebibliographyorig}{thebibliography}
\ExplSyntaxOn
\tl_new:N \l__kavi_bibbody_tl
\RenewDocumentEnvironment { thebibliography } { +b }
{
  \tl_set:Nn \l__kavi_bibbody_tl { #1 }
  \tl_replace_all:Nnn \l__kavi_bibbody_tl { ------ } { \PackageError{kavi}{ LaTeX ~ GenericError }{Don't ~ use ~ six ~ hyphens ~ in ~ a ~ row! } }
  \expandafter
  \thebibliographyorig
  \l__kavi_bibbody_tl
  \endthebibliographyorig
}{}
\ExplSyntaxOff

\begin{document}
\title{Book Title}
\author{Author Name}
\maketitle

To address these issues, \textit{WordMelodies} a mobile application to support children in the acquisition of basic literacy skills.
The app was designed to be inclusive for children with and without VIB, thus promoting interaction between them.
\textit{WordMelodies} also supports children in exercising basic touchscreen interactions on mobile devices.
    
\begin{thebibliography}{}

\bibitem{bib1}
Author N., ``Revisiting the Foundations of Network Analysis,'' {\em Science}, {325},~414--416.

\bibitem{bib2}
``Diagnosing Multicollinearity ------ Random Graph Models,'' {\em Research}, {50},~491--530.

\end{thebibliography}
\end{document}

información relacionada