0

I want to copy and paste some terminal output into my Latex document. I am using texmaker and as soon as I try to compile text like this

[trace] ?- mutter_von(Mutter, Kind).
Call: (8) mutter_von(_4028, _4030) ? creep
Exit: (8) mutter_von(marie, hans) ? creep

texmaker gives me a compilation errors because of the symbols '_', '[' and ']'. Is there any convienient way to force paste the above text into a texmaker document and replace [ to $[$ for example. Or do I need to do that manually, because thats a huge pain.

  • 3
    You could write a shell script (or whichever language you prefer) that does the conversion. Or you paste this in a verbatim environment. – Skillmon Oct 26 '19 at 15:59
  • I'm doing it currently with the help of the replace function of any text editor. What do you mean by verbatim environment? – Paul Erlenmeyer Oct 26 '19 at 16:03
  • @PaulErlenmeyer See: https://tex.stackexchange.com/questions/247404/end-verbatim-command – Davislor Oct 26 '19 at 16:52
  • 3
    @PaulErlenmeyer But for your purposes, there are commands \begin{verbatim} and \end{verbatim} that you can enclose your text in. – Davislor Oct 26 '19 at 16:54
  • @Davislor Ah thats sound great, thanks I ll try that! – Paul Erlenmeyer Oct 26 '19 at 19:01
  • How exactly do you want to use this text? Should it just be displayed like it is in the terminal? In that case \begin{verbatim}...\end{verbatim} should do (or any other verbatim environment, e.g. those provided by listings). Do you want to process this output further? In that case, writing a small parser shouldn't be too hard. – Skillmon Oct 27 '19 at 07:39

0 Answers0