Lesen Sie den Inhalt einer bestimmten Umgebung nur mit LaTeX

Lesen Sie den Inhalt einer bestimmten Umgebung nur mit LaTeX

Ich möchte den Text aus \begin{thebibliography}....\end{thebibliography}dem Umgebungstext wie im Beispiel (6 Striche) mithilfe von LaTeX2e- oder LaTeX3-Makros finden und beim Kompilieren ------Folgendes anzeigen :LaTeX GeneriorError

LaTeX filename.tex

Mein MWE ist:

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

Ich hatte geprüftSo lesen Sie die vollständige LaTeX-Datei mit LaTeX2e-Makros\thebibliographyund nicht in Umgebungen arbeiten .

Wie erreicht man das?

Antwort1

Mir ist nicht klar, ob Sie einen tatsächlichen Fehler generieren möchten (entsprechend meinem zugegebenermaßen unsicheren Versuch, Ihre Frage zu verstehen) oder ob Sie etwas wie LaTeX GenericErrorin Ihre gesetzte Ausgabe aufnehmen möchten (wie die verlinkte Antwort, die Sie akzeptiert haben, nahelegt). Da Sie bereits Code für Letzteres haben, habe ich Folgendes geändert:Cabohahs Antwortum Ersteres bereitzustellen.

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

verwandte Informationen