python - How to programmatically distinguish between a TeX and a LaTeX file -


I have a large collection of .tex files (texts / latex), and I have a python Write a script that analyzes these files, I only want to analyze latex files, so I want to delete all the pure tax files.

I have thought about making sure that \ start {document} is in every file, but it rejects a lot of my files, because many files are a book There are only chapters in long lists or a dissertation, in which there is no \ start {document} command.

Does anyone have an idea, how to filter all the pure TeX files from my collection?

I think that there is no possibility of this being a completely implicit method, given that you want to be sensitive to those files Which can be input with \ input or \ include . Looking at a special file, however, you can probably classify it with low confidence, which will detect you first of the following.

  1. The tax file is usually finished with \ Bye , and which is not usually defined in a latex file.
  2. Is the macro \ begin not likely to be defined in a general? ??? The tax file (though \ end is defined in the plain format).

    It's probably best that you can, though of course, will be enough for the statistical analysis done by you.

    There is nothing to stop someone from writing such a tax file, which does not make any sense to define \ begin , nor write some words To define \ bye is a latex file problem, from your point of view, it is that any text is not manufactured which is a latex file (and vice versa ) Are actually restricted, even if \ halign is rare in latex Actually, because latex is perfect. There is no difference between a elemental between a tex format.

    Just to move the next point home, there is one thing that is a tax format which is not plain but which is not latex though it is rare Although, though.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -