0

I'm using the package "snapshot" to generate a list of external dependencies of my filename.tex file. This list's result is stored in a filename.dep file.

The goal would be to use this filename.dep file, to extract some interesting data, and to make this data available in my filename.tex file.

The filename.dep file looks like this:

\RequireVersions{
  *{text #1 of variable length} {text #2 of variable length} {text #3 of variable length}
}

with 2 blanks in front of *, and some different spacings between the {} {}.

The interesting data for me is text #2, but only for some values of text #1. Text #3 isn't useful for me. I would like to call a command in my filename.tex file, for example

\generate_useful_dependancies[criteria on text #1]{filename}

which outputs the list of all #2 texts written in filename.dep file.

Here is the starting point, my filename.tex file (MNWE). I'm creating between \begin{filecontents} and \end{filecontents} what should be read by the command loaddata (which in the end should become my \generate_useful_dependancies command). Then next lines is what interest me.

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents*}{filename.dep}
\RequireVersions{
  *{file}   {mem10.clo}   {2022/07/29 v0.5}
}
\end{filecontents*}

\makeatletter
\newread\myread
\def\loaddata#1{%
    \def\linetomatch{Line with bar}% \edef is not required
    \openin\myread=#1
    \begingroup\endlinechar=-1
    \@whilesw\unless\ifeof\myread\fi{%
        \read\myread to \dataline
        \noindent"\linetomatch"
        \ifx\dataline\linetomatch\relax
            equals
        \else
            does not equal
        \fi
        "\dataline"\par
    }%
    \endgroup
    \closein\myread
}%
\makeatother


\begin{document}

\loaddata{filename.dep}

\end{document}

The problems are:

  • the first line is not correctly read because of the \ character
  • the last one also, probably because of }
  • then, I do not know how to read the second line in order to have text #1 and text #2.

Could someone give me some hints?

4
  • 1
    Welcome. // Please show an MWE of the Latex code you use: ready for copy and compile, pruned from code not needed to show your problem. Thanks
    – MS-SPO
    Commented Feb 2, 2023 at 18:56
  • I don't have any idea to do this, unfortunately. I'm able to change some existing codes, but I'm not able to create new code from scratch. But I was thinking of something like in the post: tex.stackexchange.com/questions/111335/…
    – Christophe
    Commented Feb 3, 2023 at 8:17
  • Well, then I'm afraid somebody will start asking to close this question, soon. This community works best with specific questions. (Pruned) Code is very specific, and tells a lot about what was tried, done or fogotten. // If you can't do it yourself, can somebody assist you in your place or environment?
    – MS-SPO
    Commented Feb 3, 2023 at 8:46
  • 1
    I'm sorry not to be as it should be (first post). I tried to edit my post so that it fits what you said in your last comment. (and I had to find out what did MWE means, as well as the idea between the word "pruned"). Thank you.
    – Christophe
    Commented Feb 3, 2023 at 17:07

0

You must log in to answer this question.

Browse other questions tagged .