pdflatex commandline hide compilation output The Next CEO of Stack OverflowWhat's the difference between pdfTeX and pdfLaTeX?Backspace in terminal output^^M garbles my terminal outputReducing output garbageoutput of pdflatex in the command line is too narrow?Find errors and warnings in pdflatex output: highlight terminal output?Accessing to .log messages from LuaTeX. Is it possible?pdflatex (command not found) on terminal for macRun pdflatex from external applicationDisplay Ubuntu terminal outputOutput formatting within message

What flight has the highest ratio of time difference to flight time?

Indicator light circuit

Bold, vivid family

What does convergence in distribution "in the Gromov–Hausdorff" sense mean?

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

Has this building technique been used in an official set?

Can I run my washing machine drain line into a condensate pump so it drains better?

What does "Its cash flow is deeply negative" mean?

Anatomically Correct Strange Women In Ponds Distributing Swords

If a black hole is created from light, can this black hole then move at speed of light?

Is there a way to save my career from absolute disaster?

What is "(CFMCC)" on an ILS approach chart?

Are there any limitations on attacking while grappling?

Why do we use the plural of movies in this phrase "We went to the movies last night."?

What's the best way to handle refactoring a big file?

Should I tutor a student who I know has cheated on their homework?

Inappropriate reference requests from Journal reviewers

Sending manuscript to multiple publishers

If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?

Multiple labels for a single equation

What can we do to stop prior company from asking us questions?

Interfacing a button to MCU (and PC) with 50m long cable

Is it professional to write unrelated content in an almost-empty email?

Why has the US not been more assertive in confronting Russia in recent years?



pdflatex commandline hide compilation output



The Next CEO of Stack OverflowWhat's the difference between pdfTeX and pdfLaTeX?Backspace in terminal output^^M garbles my terminal outputReducing output garbageoutput of pdflatex in the command line is too narrow?Find errors and warnings in pdflatex output: highlight terminal output?Accessing to .log messages from LuaTeX. Is it possible?pdflatex (command not found) on terminal for macRun pdflatex from external applicationDisplay Ubuntu terminal outputOutput formatting within message










11















My program produces multiple outputs: I have a .tex file compiled, and some of them are produced in the command-line. The compilation info of pdf-latex is useless to me and I would like to hide it to make my command-line output readable.



I have seen this site mention some box-thicking should do it, but I haven't found a command-line equivalent.










share|improve this question















migrated from stackoverflow.com Mar 20 '14 at 12:48


This question came from our site for professional and enthusiast programmers.






















    11















    My program produces multiple outputs: I have a .tex file compiled, and some of them are produced in the command-line. The compilation info of pdf-latex is useless to me and I would like to hide it to make my command-line output readable.



    I have seen this site mention some box-thicking should do it, but I haven't found a command-line equivalent.










    share|improve this question















    migrated from stackoverflow.com Mar 20 '14 at 12:48


    This question came from our site for professional and enthusiast programmers.




















      11












      11








      11


      1






      My program produces multiple outputs: I have a .tex file compiled, and some of them are produced in the command-line. The compilation info of pdf-latex is useless to me and I would like to hide it to make my command-line output readable.



      I have seen this site mention some box-thicking should do it, but I haven't found a command-line equivalent.










      share|improve this question
















      My program produces multiple outputs: I have a .tex file compiled, and some of them are produced in the command-line. The compilation info of pdf-latex is useless to me and I would like to hide it to make my command-line output readable.



      I have seen this site mention some box-thicking should do it, but I haven't found a command-line equivalent.







      terminal-output






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 11 '15 at 0:08









      Paul Gessler

      23.3k476174




      23.3k476174










      asked Mar 19 '14 at 8:08







      Haxelaar











      migrated from stackoverflow.com Mar 20 '14 at 12:48


      This question came from our site for professional and enthusiast programmers.









      migrated from stackoverflow.com Mar 20 '14 at 12:48


      This question came from our site for professional and enthusiast programmers.






















          4 Answers
          4






          active

          oldest

          votes


















          14














          You can either redirect all of the pdflatex output:



          • for sh: pdflatex ... > /dev/null 2>&1

          • for cmd: pdflatex ... > NUL 2>&1

          Or you can use the -quiet option:



          pdflatex -quiet ...





          share|improve this answer


















          • 1





            the quiet-option would be perfect, but "pdflatex: unrecognized option '-quiet'"

            – Haxelaar
            Mar 19 '14 at 8:19






          • 2





            @Haxelaar Hmm, it seems to be present for the MiKTeX 2.9 pdflatex version, but the Arch Linux TeXLive version does not have it indeed. Then redirecting output is your only option. You can leave out the 2>&1 bit if you still want to show errors (and maybe warnings, depending on how pdflatex outputs them).

            – rubenvb
            Mar 19 '14 at 8:36






          • 6





            Using pdflatex --interaction=batchmode ... hides almost all of the output

            – Andrew
            Mar 2 '17 at 1:51


















          5
















          In my case, there is no -quiet mode. So I had to use -interaction=batchmode argument as suggeseted by Andrew's comment.



          But then another problem arised - you will not see what went wrong and why, because errors are also suppressed with batchmode.



          The result I end up using is to suppress all pdflatex's output by using grep to output only errors:



          : | pdflatex -halt-on-error src.tex | grep '^!.*' -A200 --color=always 


          I use -halt-on-error because you basically can't use interactive mode in case of error (grep disables dialog between program and user). Also, to make sure that pdflatex does never prompt for the input, let's pipe in command with no output (: command).



          Let me also explain the grep arguments:




          • ^!.*

            • string to search for in the output from pdflatex

            • it matches all lines that start with !, which are considered error lines



          • -A200

            • output 200 lines after every match

            • this way I make sure to print also the relevant information followed after the matched error lines



          • --color=always

            • this provides us colored output so that we can clearly see what went wrong and why - the problem is bold red



          Wrapper script



          I've created a wrapper script to provide more convenient solution exactly for this purpose. It's usage is almost the same as pdflatex / pdftex itself. You can check it out as a CTAN package or as a GitLab repository.



          Quickinstall



          And here is how to install the latest version using this oneliner:



          curl -s https://gitlab.com/jirislav/pdftex-quiet/raw/latest/pdftex-quiet | 
          sudo tee /usr/local/bin/pdftex-quiet >/dev/null
          && sudo chmod +x /usr/local/bin/pdftex-quiet
          && sudo ln -sf /usr/local/bin/pdftex-quiet /usr/local/bin/pdflatex-quiet


          Here is an example of how you run the wrapper script:



          pdftex-quiet compile-me.tex
          # You may also provide additional attributes to `pdflatex`
          pdflatex-quiet -output-format=dvi -output-directory=/tmp compile-me.tex


          You can also show version or help of the pdflatex-quiet / pdftex-quiet script:



          pdflatex-quiet -v # or --version
          pdflatex-quiet -h # or --help


          Also the difference between pdflatex-quiet and pdftex-quiet, as explained here is respected - thanks to Denis Bitouzé's comment.






          share|improve this answer




















          • 1





            Welcome to TeX.SX! Very nice contribution!

            – egreg
            Nov 11 '18 at 15:09











          • Thank you :) I've further improved the proposed answer so that it has disabled stdin when running pdflatex with : command, because it would seem to hang up when it prompts for input (grep doesn't print characters until newline is printed, so you can't possibly know what it's waiting for). Oh and I've found out that pdflatex always prints ! at the start of the line describing problem, so I've also updated the grep expression and added colored output so that you see exactly what have failed. And finally, I've added final pdf/div filename to be printed in the bash script on success.

            – jirislav
            Nov 11 '18 at 16:34












          • Would you like to submit it to CTAN?

            – egreg
            Nov 11 '18 at 16:46











          • I've never submitted anything there until now :) .. I've called it pdfla­tex-quiet

            – jirislav
            Nov 11 '18 at 17:30











          • perhaps you could get in touch with Latexmk maintainer and suggest incorporation into it

            – user4686
            Nov 12 '18 at 22:31


















          3














          FWIW, https://ctan.org/pkg/texfot was my attempt at solving this problem -- eliminating the verbose output from tex engines while still showing the interesting messages (the ones I actually want to do something about). --karl






          share|improve this answer






























            1














            Tex-to-pdf compiler function



            I ended up combining the answers from
            rubenvb,
            Andrew and
            jirislav
            and putting it as a function in my .bashrc.



            Short version



            All the output is redirected in a .txt file.
            The error messages of this file are displayed and the .txt file removed.



            You can put the following function in your .bashrc:



            function tex-pdf 
            pdflatex -halt-on-error -interaction=nonstopmode $1 > $1.txt
            grep '^!.*' --color=always $1.txt
            rm $1.txt

            export -f tex-pdf


            You can use it like



            $ tex-pdf report


            Long version



            If you use BibTeX or want to remove files that are created during compilation,
            but you don't need, you can extend the function in the following way:



            function tex-pdf $
            export -f tex-pdf


            If there are no errors in your code, the output will be:



            $ tex-pdf report
            Step 1/4 - pdflatex

            Step 2/4 - bibtex

            Step 3/4 - pdflatex

            Step 4/4 - pdflatex





            share|improve this answer










            New contributor




            David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.




















              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "85"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f166658%2fpdflatex-commandline-hide-compilation-output%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown
























              4 Answers
              4






              active

              oldest

              votes








              4 Answers
              4






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              14














              You can either redirect all of the pdflatex output:



              • for sh: pdflatex ... > /dev/null 2>&1

              • for cmd: pdflatex ... > NUL 2>&1

              Or you can use the -quiet option:



              pdflatex -quiet ...





              share|improve this answer


















              • 1





                the quiet-option would be perfect, but "pdflatex: unrecognized option '-quiet'"

                – Haxelaar
                Mar 19 '14 at 8:19






              • 2





                @Haxelaar Hmm, it seems to be present for the MiKTeX 2.9 pdflatex version, but the Arch Linux TeXLive version does not have it indeed. Then redirecting output is your only option. You can leave out the 2>&1 bit if you still want to show errors (and maybe warnings, depending on how pdflatex outputs them).

                – rubenvb
                Mar 19 '14 at 8:36






              • 6





                Using pdflatex --interaction=batchmode ... hides almost all of the output

                – Andrew
                Mar 2 '17 at 1:51















              14














              You can either redirect all of the pdflatex output:



              • for sh: pdflatex ... > /dev/null 2>&1

              • for cmd: pdflatex ... > NUL 2>&1

              Or you can use the -quiet option:



              pdflatex -quiet ...





              share|improve this answer


















              • 1





                the quiet-option would be perfect, but "pdflatex: unrecognized option '-quiet'"

                – Haxelaar
                Mar 19 '14 at 8:19






              • 2





                @Haxelaar Hmm, it seems to be present for the MiKTeX 2.9 pdflatex version, but the Arch Linux TeXLive version does not have it indeed. Then redirecting output is your only option. You can leave out the 2>&1 bit if you still want to show errors (and maybe warnings, depending on how pdflatex outputs them).

                – rubenvb
                Mar 19 '14 at 8:36






              • 6





                Using pdflatex --interaction=batchmode ... hides almost all of the output

                – Andrew
                Mar 2 '17 at 1:51













              14












              14








              14







              You can either redirect all of the pdflatex output:



              • for sh: pdflatex ... > /dev/null 2>&1

              • for cmd: pdflatex ... > NUL 2>&1

              Or you can use the -quiet option:



              pdflatex -quiet ...





              share|improve this answer













              You can either redirect all of the pdflatex output:



              • for sh: pdflatex ... > /dev/null 2>&1

              • for cmd: pdflatex ... > NUL 2>&1

              Or you can use the -quiet option:



              pdflatex -quiet ...






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Mar 19 '14 at 8:14









              rubenvbrubenvb

              1,92821727




              1,92821727







              • 1





                the quiet-option would be perfect, but "pdflatex: unrecognized option '-quiet'"

                – Haxelaar
                Mar 19 '14 at 8:19






              • 2





                @Haxelaar Hmm, it seems to be present for the MiKTeX 2.9 pdflatex version, but the Arch Linux TeXLive version does not have it indeed. Then redirecting output is your only option. You can leave out the 2>&1 bit if you still want to show errors (and maybe warnings, depending on how pdflatex outputs them).

                – rubenvb
                Mar 19 '14 at 8:36






              • 6





                Using pdflatex --interaction=batchmode ... hides almost all of the output

                – Andrew
                Mar 2 '17 at 1:51












              • 1





                the quiet-option would be perfect, but "pdflatex: unrecognized option '-quiet'"

                – Haxelaar
                Mar 19 '14 at 8:19






              • 2





                @Haxelaar Hmm, it seems to be present for the MiKTeX 2.9 pdflatex version, but the Arch Linux TeXLive version does not have it indeed. Then redirecting output is your only option. You can leave out the 2>&1 bit if you still want to show errors (and maybe warnings, depending on how pdflatex outputs them).

                – rubenvb
                Mar 19 '14 at 8:36






              • 6





                Using pdflatex --interaction=batchmode ... hides almost all of the output

                – Andrew
                Mar 2 '17 at 1:51







              1




              1





              the quiet-option would be perfect, but "pdflatex: unrecognized option '-quiet'"

              – Haxelaar
              Mar 19 '14 at 8:19





              the quiet-option would be perfect, but "pdflatex: unrecognized option '-quiet'"

              – Haxelaar
              Mar 19 '14 at 8:19




              2




              2





              @Haxelaar Hmm, it seems to be present for the MiKTeX 2.9 pdflatex version, but the Arch Linux TeXLive version does not have it indeed. Then redirecting output is your only option. You can leave out the 2>&1 bit if you still want to show errors (and maybe warnings, depending on how pdflatex outputs them).

              – rubenvb
              Mar 19 '14 at 8:36





              @Haxelaar Hmm, it seems to be present for the MiKTeX 2.9 pdflatex version, but the Arch Linux TeXLive version does not have it indeed. Then redirecting output is your only option. You can leave out the 2>&1 bit if you still want to show errors (and maybe warnings, depending on how pdflatex outputs them).

              – rubenvb
              Mar 19 '14 at 8:36




              6




              6





              Using pdflatex --interaction=batchmode ... hides almost all of the output

              – Andrew
              Mar 2 '17 at 1:51





              Using pdflatex --interaction=batchmode ... hides almost all of the output

              – Andrew
              Mar 2 '17 at 1:51











              5
















              In my case, there is no -quiet mode. So I had to use -interaction=batchmode argument as suggeseted by Andrew's comment.



              But then another problem arised - you will not see what went wrong and why, because errors are also suppressed with batchmode.



              The result I end up using is to suppress all pdflatex's output by using grep to output only errors:



              : | pdflatex -halt-on-error src.tex | grep '^!.*' -A200 --color=always 


              I use -halt-on-error because you basically can't use interactive mode in case of error (grep disables dialog between program and user). Also, to make sure that pdflatex does never prompt for the input, let's pipe in command with no output (: command).



              Let me also explain the grep arguments:




              • ^!.*

                • string to search for in the output from pdflatex

                • it matches all lines that start with !, which are considered error lines



              • -A200

                • output 200 lines after every match

                • this way I make sure to print also the relevant information followed after the matched error lines



              • --color=always

                • this provides us colored output so that we can clearly see what went wrong and why - the problem is bold red



              Wrapper script



              I've created a wrapper script to provide more convenient solution exactly for this purpose. It's usage is almost the same as pdflatex / pdftex itself. You can check it out as a CTAN package or as a GitLab repository.



              Quickinstall



              And here is how to install the latest version using this oneliner:



              curl -s https://gitlab.com/jirislav/pdftex-quiet/raw/latest/pdftex-quiet | 
              sudo tee /usr/local/bin/pdftex-quiet >/dev/null
              && sudo chmod +x /usr/local/bin/pdftex-quiet
              && sudo ln -sf /usr/local/bin/pdftex-quiet /usr/local/bin/pdflatex-quiet


              Here is an example of how you run the wrapper script:



              pdftex-quiet compile-me.tex
              # You may also provide additional attributes to `pdflatex`
              pdflatex-quiet -output-format=dvi -output-directory=/tmp compile-me.tex


              You can also show version or help of the pdflatex-quiet / pdftex-quiet script:



              pdflatex-quiet -v # or --version
              pdflatex-quiet -h # or --help


              Also the difference between pdflatex-quiet and pdftex-quiet, as explained here is respected - thanks to Denis Bitouzé's comment.






              share|improve this answer




















              • 1





                Welcome to TeX.SX! Very nice contribution!

                – egreg
                Nov 11 '18 at 15:09











              • Thank you :) I've further improved the proposed answer so that it has disabled stdin when running pdflatex with : command, because it would seem to hang up when it prompts for input (grep doesn't print characters until newline is printed, so you can't possibly know what it's waiting for). Oh and I've found out that pdflatex always prints ! at the start of the line describing problem, so I've also updated the grep expression and added colored output so that you see exactly what have failed. And finally, I've added final pdf/div filename to be printed in the bash script on success.

                – jirislav
                Nov 11 '18 at 16:34












              • Would you like to submit it to CTAN?

                – egreg
                Nov 11 '18 at 16:46











              • I've never submitted anything there until now :) .. I've called it pdfla­tex-quiet

                – jirislav
                Nov 11 '18 at 17:30











              • perhaps you could get in touch with Latexmk maintainer and suggest incorporation into it

                – user4686
                Nov 12 '18 at 22:31















              5
















              In my case, there is no -quiet mode. So I had to use -interaction=batchmode argument as suggeseted by Andrew's comment.



              But then another problem arised - you will not see what went wrong and why, because errors are also suppressed with batchmode.



              The result I end up using is to suppress all pdflatex's output by using grep to output only errors:



              : | pdflatex -halt-on-error src.tex | grep '^!.*' -A200 --color=always 


              I use -halt-on-error because you basically can't use interactive mode in case of error (grep disables dialog between program and user). Also, to make sure that pdflatex does never prompt for the input, let's pipe in command with no output (: command).



              Let me also explain the grep arguments:




              • ^!.*

                • string to search for in the output from pdflatex

                • it matches all lines that start with !, which are considered error lines



              • -A200

                • output 200 lines after every match

                • this way I make sure to print also the relevant information followed after the matched error lines



              • --color=always

                • this provides us colored output so that we can clearly see what went wrong and why - the problem is bold red



              Wrapper script



              I've created a wrapper script to provide more convenient solution exactly for this purpose. It's usage is almost the same as pdflatex / pdftex itself. You can check it out as a CTAN package or as a GitLab repository.



              Quickinstall



              And here is how to install the latest version using this oneliner:



              curl -s https://gitlab.com/jirislav/pdftex-quiet/raw/latest/pdftex-quiet | 
              sudo tee /usr/local/bin/pdftex-quiet >/dev/null
              && sudo chmod +x /usr/local/bin/pdftex-quiet
              && sudo ln -sf /usr/local/bin/pdftex-quiet /usr/local/bin/pdflatex-quiet


              Here is an example of how you run the wrapper script:



              pdftex-quiet compile-me.tex
              # You may also provide additional attributes to `pdflatex`
              pdflatex-quiet -output-format=dvi -output-directory=/tmp compile-me.tex


              You can also show version or help of the pdflatex-quiet / pdftex-quiet script:



              pdflatex-quiet -v # or --version
              pdflatex-quiet -h # or --help


              Also the difference between pdflatex-quiet and pdftex-quiet, as explained here is respected - thanks to Denis Bitouzé's comment.






              share|improve this answer




















              • 1





                Welcome to TeX.SX! Very nice contribution!

                – egreg
                Nov 11 '18 at 15:09











              • Thank you :) I've further improved the proposed answer so that it has disabled stdin when running pdflatex with : command, because it would seem to hang up when it prompts for input (grep doesn't print characters until newline is printed, so you can't possibly know what it's waiting for). Oh and I've found out that pdflatex always prints ! at the start of the line describing problem, so I've also updated the grep expression and added colored output so that you see exactly what have failed. And finally, I've added final pdf/div filename to be printed in the bash script on success.

                – jirislav
                Nov 11 '18 at 16:34












              • Would you like to submit it to CTAN?

                – egreg
                Nov 11 '18 at 16:46











              • I've never submitted anything there until now :) .. I've called it pdfla­tex-quiet

                – jirislav
                Nov 11 '18 at 17:30











              • perhaps you could get in touch with Latexmk maintainer and suggest incorporation into it

                – user4686
                Nov 12 '18 at 22:31













              5












              5








              5









              In my case, there is no -quiet mode. So I had to use -interaction=batchmode argument as suggeseted by Andrew's comment.



              But then another problem arised - you will not see what went wrong and why, because errors are also suppressed with batchmode.



              The result I end up using is to suppress all pdflatex's output by using grep to output only errors:



              : | pdflatex -halt-on-error src.tex | grep '^!.*' -A200 --color=always 


              I use -halt-on-error because you basically can't use interactive mode in case of error (grep disables dialog between program and user). Also, to make sure that pdflatex does never prompt for the input, let's pipe in command with no output (: command).



              Let me also explain the grep arguments:




              • ^!.*

                • string to search for in the output from pdflatex

                • it matches all lines that start with !, which are considered error lines



              • -A200

                • output 200 lines after every match

                • this way I make sure to print also the relevant information followed after the matched error lines



              • --color=always

                • this provides us colored output so that we can clearly see what went wrong and why - the problem is bold red



              Wrapper script



              I've created a wrapper script to provide more convenient solution exactly for this purpose. It's usage is almost the same as pdflatex / pdftex itself. You can check it out as a CTAN package or as a GitLab repository.



              Quickinstall



              And here is how to install the latest version using this oneliner:



              curl -s https://gitlab.com/jirislav/pdftex-quiet/raw/latest/pdftex-quiet | 
              sudo tee /usr/local/bin/pdftex-quiet >/dev/null
              && sudo chmod +x /usr/local/bin/pdftex-quiet
              && sudo ln -sf /usr/local/bin/pdftex-quiet /usr/local/bin/pdflatex-quiet


              Here is an example of how you run the wrapper script:



              pdftex-quiet compile-me.tex
              # You may also provide additional attributes to `pdflatex`
              pdflatex-quiet -output-format=dvi -output-directory=/tmp compile-me.tex


              You can also show version or help of the pdflatex-quiet / pdftex-quiet script:



              pdflatex-quiet -v # or --version
              pdflatex-quiet -h # or --help


              Also the difference between pdflatex-quiet and pdftex-quiet, as explained here is respected - thanks to Denis Bitouzé's comment.






              share|improve this answer

















              In my case, there is no -quiet mode. So I had to use -interaction=batchmode argument as suggeseted by Andrew's comment.



              But then another problem arised - you will not see what went wrong and why, because errors are also suppressed with batchmode.



              The result I end up using is to suppress all pdflatex's output by using grep to output only errors:



              : | pdflatex -halt-on-error src.tex | grep '^!.*' -A200 --color=always 


              I use -halt-on-error because you basically can't use interactive mode in case of error (grep disables dialog between program and user). Also, to make sure that pdflatex does never prompt for the input, let's pipe in command with no output (: command).



              Let me also explain the grep arguments:




              • ^!.*

                • string to search for in the output from pdflatex

                • it matches all lines that start with !, which are considered error lines



              • -A200

                • output 200 lines after every match

                • this way I make sure to print also the relevant information followed after the matched error lines



              • --color=always

                • this provides us colored output so that we can clearly see what went wrong and why - the problem is bold red



              Wrapper script



              I've created a wrapper script to provide more convenient solution exactly for this purpose. It's usage is almost the same as pdflatex / pdftex itself. You can check it out as a CTAN package or as a GitLab repository.



              Quickinstall



              And here is how to install the latest version using this oneliner:



              curl -s https://gitlab.com/jirislav/pdftex-quiet/raw/latest/pdftex-quiet | 
              sudo tee /usr/local/bin/pdftex-quiet >/dev/null
              && sudo chmod +x /usr/local/bin/pdftex-quiet
              && sudo ln -sf /usr/local/bin/pdftex-quiet /usr/local/bin/pdflatex-quiet


              Here is an example of how you run the wrapper script:



              pdftex-quiet compile-me.tex
              # You may also provide additional attributes to `pdflatex`
              pdflatex-quiet -output-format=dvi -output-directory=/tmp compile-me.tex


              You can also show version or help of the pdflatex-quiet / pdftex-quiet script:



              pdflatex-quiet -v # or --version
              pdflatex-quiet -h # or --help


              Also the difference between pdflatex-quiet and pdftex-quiet, as explained here is respected - thanks to Denis Bitouzé's comment.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Nov 14 '18 at 23:17

























              answered Nov 11 '18 at 14:43









              jirislavjirislav

              5114




              5114







              • 1





                Welcome to TeX.SX! Very nice contribution!

                – egreg
                Nov 11 '18 at 15:09











              • Thank you :) I've further improved the proposed answer so that it has disabled stdin when running pdflatex with : command, because it would seem to hang up when it prompts for input (grep doesn't print characters until newline is printed, so you can't possibly know what it's waiting for). Oh and I've found out that pdflatex always prints ! at the start of the line describing problem, so I've also updated the grep expression and added colored output so that you see exactly what have failed. And finally, I've added final pdf/div filename to be printed in the bash script on success.

                – jirislav
                Nov 11 '18 at 16:34












              • Would you like to submit it to CTAN?

                – egreg
                Nov 11 '18 at 16:46











              • I've never submitted anything there until now :) .. I've called it pdfla­tex-quiet

                – jirislav
                Nov 11 '18 at 17:30











              • perhaps you could get in touch with Latexmk maintainer and suggest incorporation into it

                – user4686
                Nov 12 '18 at 22:31












              • 1





                Welcome to TeX.SX! Very nice contribution!

                – egreg
                Nov 11 '18 at 15:09











              • Thank you :) I've further improved the proposed answer so that it has disabled stdin when running pdflatex with : command, because it would seem to hang up when it prompts for input (grep doesn't print characters until newline is printed, so you can't possibly know what it's waiting for). Oh and I've found out that pdflatex always prints ! at the start of the line describing problem, so I've also updated the grep expression and added colored output so that you see exactly what have failed. And finally, I've added final pdf/div filename to be printed in the bash script on success.

                – jirislav
                Nov 11 '18 at 16:34












              • Would you like to submit it to CTAN?

                – egreg
                Nov 11 '18 at 16:46











              • I've never submitted anything there until now :) .. I've called it pdfla­tex-quiet

                – jirislav
                Nov 11 '18 at 17:30











              • perhaps you could get in touch with Latexmk maintainer and suggest incorporation into it

                – user4686
                Nov 12 '18 at 22:31







              1




              1





              Welcome to TeX.SX! Very nice contribution!

              – egreg
              Nov 11 '18 at 15:09





              Welcome to TeX.SX! Very nice contribution!

              – egreg
              Nov 11 '18 at 15:09













              Thank you :) I've further improved the proposed answer so that it has disabled stdin when running pdflatex with : command, because it would seem to hang up when it prompts for input (grep doesn't print characters until newline is printed, so you can't possibly know what it's waiting for). Oh and I've found out that pdflatex always prints ! at the start of the line describing problem, so I've also updated the grep expression and added colored output so that you see exactly what have failed. And finally, I've added final pdf/div filename to be printed in the bash script on success.

              – jirislav
              Nov 11 '18 at 16:34






              Thank you :) I've further improved the proposed answer so that it has disabled stdin when running pdflatex with : command, because it would seem to hang up when it prompts for input (grep doesn't print characters until newline is printed, so you can't possibly know what it's waiting for). Oh and I've found out that pdflatex always prints ! at the start of the line describing problem, so I've also updated the grep expression and added colored output so that you see exactly what have failed. And finally, I've added final pdf/div filename to be printed in the bash script on success.

              – jirislav
              Nov 11 '18 at 16:34














              Would you like to submit it to CTAN?

              – egreg
              Nov 11 '18 at 16:46





              Would you like to submit it to CTAN?

              – egreg
              Nov 11 '18 at 16:46













              I've never submitted anything there until now :) .. I've called it pdfla­tex-quiet

              – jirislav
              Nov 11 '18 at 17:30





              I've never submitted anything there until now :) .. I've called it pdfla­tex-quiet

              – jirislav
              Nov 11 '18 at 17:30













              perhaps you could get in touch with Latexmk maintainer and suggest incorporation into it

              – user4686
              Nov 12 '18 at 22:31





              perhaps you could get in touch with Latexmk maintainer and suggest incorporation into it

              – user4686
              Nov 12 '18 at 22:31











              3














              FWIW, https://ctan.org/pkg/texfot was my attempt at solving this problem -- eliminating the verbose output from tex engines while still showing the interesting messages (the ones I actually want to do something about). --karl






              share|improve this answer



























                3














                FWIW, https://ctan.org/pkg/texfot was my attempt at solving this problem -- eliminating the verbose output from tex engines while still showing the interesting messages (the ones I actually want to do something about). --karl






                share|improve this answer

























                  3












                  3








                  3







                  FWIW, https://ctan.org/pkg/texfot was my attempt at solving this problem -- eliminating the verbose output from tex engines while still showing the interesting messages (the ones I actually want to do something about). --karl






                  share|improve this answer













                  FWIW, https://ctan.org/pkg/texfot was my attempt at solving this problem -- eliminating the verbose output from tex engines while still showing the interesting messages (the ones I actually want to do something about). --karl







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 12 '18 at 22:13









                  Karl BerryKarl Berry

                  65973




                  65973





















                      1














                      Tex-to-pdf compiler function



                      I ended up combining the answers from
                      rubenvb,
                      Andrew and
                      jirislav
                      and putting it as a function in my .bashrc.



                      Short version



                      All the output is redirected in a .txt file.
                      The error messages of this file are displayed and the .txt file removed.



                      You can put the following function in your .bashrc:



                      function tex-pdf 
                      pdflatex -halt-on-error -interaction=nonstopmode $1 > $1.txt
                      grep '^!.*' --color=always $1.txt
                      rm $1.txt

                      export -f tex-pdf


                      You can use it like



                      $ tex-pdf report


                      Long version



                      If you use BibTeX or want to remove files that are created during compilation,
                      but you don't need, you can extend the function in the following way:



                      function tex-pdf $
                      export -f tex-pdf


                      If there are no errors in your code, the output will be:



                      $ tex-pdf report
                      Step 1/4 - pdflatex

                      Step 2/4 - bibtex

                      Step 3/4 - pdflatex

                      Step 4/4 - pdflatex





                      share|improve this answer










                      New contributor




                      David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.
























                        1














                        Tex-to-pdf compiler function



                        I ended up combining the answers from
                        rubenvb,
                        Andrew and
                        jirislav
                        and putting it as a function in my .bashrc.



                        Short version



                        All the output is redirected in a .txt file.
                        The error messages of this file are displayed and the .txt file removed.



                        You can put the following function in your .bashrc:



                        function tex-pdf 
                        pdflatex -halt-on-error -interaction=nonstopmode $1 > $1.txt
                        grep '^!.*' --color=always $1.txt
                        rm $1.txt

                        export -f tex-pdf


                        You can use it like



                        $ tex-pdf report


                        Long version



                        If you use BibTeX or want to remove files that are created during compilation,
                        but you don't need, you can extend the function in the following way:



                        function tex-pdf $
                        export -f tex-pdf


                        If there are no errors in your code, the output will be:



                        $ tex-pdf report
                        Step 1/4 - pdflatex

                        Step 2/4 - bibtex

                        Step 3/4 - pdflatex

                        Step 4/4 - pdflatex





                        share|improve this answer










                        New contributor




                        David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.






















                          1












                          1








                          1







                          Tex-to-pdf compiler function



                          I ended up combining the answers from
                          rubenvb,
                          Andrew and
                          jirislav
                          and putting it as a function in my .bashrc.



                          Short version



                          All the output is redirected in a .txt file.
                          The error messages of this file are displayed and the .txt file removed.



                          You can put the following function in your .bashrc:



                          function tex-pdf 
                          pdflatex -halt-on-error -interaction=nonstopmode $1 > $1.txt
                          grep '^!.*' --color=always $1.txt
                          rm $1.txt

                          export -f tex-pdf


                          You can use it like



                          $ tex-pdf report


                          Long version



                          If you use BibTeX or want to remove files that are created during compilation,
                          but you don't need, you can extend the function in the following way:



                          function tex-pdf $
                          export -f tex-pdf


                          If there are no errors in your code, the output will be:



                          $ tex-pdf report
                          Step 1/4 - pdflatex

                          Step 2/4 - bibtex

                          Step 3/4 - pdflatex

                          Step 4/4 - pdflatex





                          share|improve this answer










                          New contributor




                          David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.










                          Tex-to-pdf compiler function



                          I ended up combining the answers from
                          rubenvb,
                          Andrew and
                          jirislav
                          and putting it as a function in my .bashrc.



                          Short version



                          All the output is redirected in a .txt file.
                          The error messages of this file are displayed and the .txt file removed.



                          You can put the following function in your .bashrc:



                          function tex-pdf 
                          pdflatex -halt-on-error -interaction=nonstopmode $1 > $1.txt
                          grep '^!.*' --color=always $1.txt
                          rm $1.txt

                          export -f tex-pdf


                          You can use it like



                          $ tex-pdf report


                          Long version



                          If you use BibTeX or want to remove files that are created during compilation,
                          but you don't need, you can extend the function in the following way:



                          function tex-pdf $
                          export -f tex-pdf


                          If there are no errors in your code, the output will be:



                          $ tex-pdf report
                          Step 1/4 - pdflatex

                          Step 2/4 - bibtex

                          Step 3/4 - pdflatex

                          Step 4/4 - pdflatex






                          share|improve this answer










                          New contributor




                          David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          share|improve this answer



                          share|improve this answer








                          edited 10 hours ago





















                          New contributor




                          David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          answered 12 hours ago









                          DavidDavid

                          112




                          112




                          New contributor




                          David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





                          New contributor





                          David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






                          David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f166658%2fpdflatex-commandline-hide-compilation-output%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Tórshavn Kliima | Partnerstääden | Luke uk diar | Nawigatsjuun62° 1′ N, 6° 46′ W62° 1′ 0″ N, 6° 46′ 0″ WWMOTórshavn

                              南部首創開放式體驗廚房 用智慧廚具做出好料理

                              Error: MikTex console already running The Next CEO of Stack OverflowMikTex Console already runningWhy Windows API 5 error when running initexmf in MiKTeX?LyX & MiKTeX installation problems on Windows 7Missing .dll file prevents MiKTeX package manager from openingMikTeX Update corrupts the installationMikTeX 2.9 does not respond under Windows 10 Pro 64 bitError with BibTeX when compiling in MiKTeXProblem installing MikTex 2.9 on Windows 10 (64 bit)Unable to uninstall MikTeX from Windows 10MikTex Console already runningMikTeX Console stop working