How to repair corrput files that still has their content intact?

I was creating a beamer presentation and then TeXmacs crashed. I opened the file again but it is blank. I open the .tm file in a text editor; luckily, the content is still there. How do make texmacs display the content (in other words, how do I know which piece of code is preventing TeXmacs from displaying the underlying content?).

Here’s the file: https://pastebin.com/u1a1v0Mj

I think the bisection method is the only practical one :slight_smile:

For me this file works, kind of. It opens, but something strange is happening with the pygments blocks. Some commas appear, which don’t seem to be in the source file. They are transformed into a few gibberish characters:

The pygments package for texmacs strips away any new lines (empty lines). I was trying to force new lines by inserting an space character. Could this be the reason for the corruption?

Could you check if you’ve pulled the latest commit of pygments? I’ve made some changes to the handling of newlines recently.

1 Like

I just did and it indeed solves the new line issue. However, when exporting to PDF, it does not export the rendered text. It also duplicates the slide. Here’s how the exported PDF looks:

Here’s a sample file for you to test:

<TeXmacs|2.1.1>

<style|beamer>

<\body>
  <screens|<\hidden>
    <tit|Introduction to Verilog-A>

    \;
  </hidden>|<\shown>
    <tit|A simple resistor model>

    \;

    A model of a simple linear resistor is given below.

    <\code>
      <\script-output|pygments|default>
        %verilog; xcode
        parameter real s=10;
      <|script-output>
        <\verbatim-code>
          <with|color|#A90D91|parameter> <with|color|#A90D91|real>
          <with|color|#000000|s><with|color|#000000|=><with|color|#1C01CE|10>;
        </verbatim-code>
      </script-output>
    </code>
    \;
  </shown>>
</body>

<initial|<\collection>
</collection>>

Yes, this a problem in the pdf export. See this bug report for some of my comments on it and a possible solution:
https://savannah.gnu.org/bugs/?func=detailitem&item_id=59540

Unfortunately, due to a lack of developers, it can take a long time for issues to get resolved. It may be possible to apply these changes via my-init-texmacs.scm.

One last question, if you don’t mind. How do I input the backtick character in code blocks? At the moment, it looks like the open single quote character.

I would think backtick followed by Tab, but this somehow gets mangled by the Pygments plugin. I will have to investigate this.