Leia o ambiente específico do conteúdo usando apenas LaTeX

Leia o ambiente específico do conteúdo usando apenas LaTeX

Gostaria de encontrar o texto do \begin{thebibliography}....\end{thebibliography}texto do ambiente como exemplo ------(6 traços) usando macros LaTeX2e ou LaTeX3 e será exibido LaTeX GeneriorErrordurante a compilação:

LaTeX filename.tex

Meu MWE é:

\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}

eu tinha verificadoPara ler o arquivo LaTeX completo usando macros LaTeX2ee não trabalhar em \thebibliographyambientes.

Como conseguir isso?

Responder1

Não estou claro se você deseja gerar um erro real (de acordo com minha tentativa reconhecidamente incerta de entender sua pergunta) ou se deseja incluir algo como LaTeX GenericErrorem sua saída tipográfica (como sugere a resposta vinculada que você aceitou). Como você já tem código para este último, modifiqueiresposta de cabohahpara fornecer o primeiro.

\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}

informação relacionada