How to avoid showing the filename when using graphicx?












31














I am writing a LaTeX document with the apacite and graphicx package. The issue is when I include an image either using figure with an enclosed includegraphics or includegraphics by itself it shows the image with the file name to the side.



For example:



            --------------
| |
| BOX 1 |
---------------
Error1.jpg


I do not want it to write Error1.jpg. Would show the image but it seems I do not have enough rep.



This is an example tex file to show the error (with Windows XP, using Miktex 2.8).



documentclass[man]{apa}
usepackage{apacite}
usepackage{graphicx}
usepackage[utf8]{inputenc}
usepackage[english]{babel}
begin{document}

includegraphics{Example Error1.jpg}
begin{figure}[htb]
includegraphics{Example Error1.jpg}
caption{This is the caption of the figure.}
label{fig:fig2}
end{figure}
end{document}









share|improve this question





























    31














    I am writing a LaTeX document with the apacite and graphicx package. The issue is when I include an image either using figure with an enclosed includegraphics or includegraphics by itself it shows the image with the file name to the side.



    For example:



                --------------
    | |
    | BOX 1 |
    ---------------
    Error1.jpg


    I do not want it to write Error1.jpg. Would show the image but it seems I do not have enough rep.



    This is an example tex file to show the error (with Windows XP, using Miktex 2.8).



    documentclass[man]{apa}
    usepackage{apacite}
    usepackage{graphicx}
    usepackage[utf8]{inputenc}
    usepackage[english]{babel}
    begin{document}

    includegraphics{Example Error1.jpg}
    begin{figure}[htb]
    includegraphics{Example Error1.jpg}
    caption{This is the caption of the figure.}
    label{fig:fig2}
    end{figure}
    end{document}









    share|improve this question



























      31












      31








      31


      5





      I am writing a LaTeX document with the apacite and graphicx package. The issue is when I include an image either using figure with an enclosed includegraphics or includegraphics by itself it shows the image with the file name to the side.



      For example:



                  --------------
      | |
      | BOX 1 |
      ---------------
      Error1.jpg


      I do not want it to write Error1.jpg. Would show the image but it seems I do not have enough rep.



      This is an example tex file to show the error (with Windows XP, using Miktex 2.8).



      documentclass[man]{apa}
      usepackage{apacite}
      usepackage{graphicx}
      usepackage[utf8]{inputenc}
      usepackage[english]{babel}
      begin{document}

      includegraphics{Example Error1.jpg}
      begin{figure}[htb]
      includegraphics{Example Error1.jpg}
      caption{This is the caption of the figure.}
      label{fig:fig2}
      end{figure}
      end{document}









      share|improve this question















      I am writing a LaTeX document with the apacite and graphicx package. The issue is when I include an image either using figure with an enclosed includegraphics or includegraphics by itself it shows the image with the file name to the side.



      For example:



                  --------------
      | |
      | BOX 1 |
      ---------------
      Error1.jpg


      I do not want it to write Error1.jpg. Would show the image but it seems I do not have enough rep.



      This is an example tex file to show the error (with Windows XP, using Miktex 2.8).



      documentclass[man]{apa}
      usepackage{apacite}
      usepackage{graphicx}
      usepackage[utf8]{inputenc}
      usepackage[english]{babel}
      begin{document}

      includegraphics{Example Error1.jpg}
      begin{figure}[htb]
      includegraphics{Example Error1.jpg}
      caption{This is the caption of the figure.}
      label{fig:fig2}
      end{figure}
      end{document}






      graphics






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 15 '12 at 23:27









      egreg

      709k8618853167




      709k8618853167










      asked Oct 14 '10 at 15:41









      ThorDivDev

      318137




      318137






















          5 Answers
          5






          active

          oldest

          votes


















          43














          Old post, but you can do the following.



          includegraphics{"Example Error1".jpg}





          share|improve this answer



















          • 5




            This should definitely be the chosen answer.
            – LondonRob
            Jun 9 '14 at 14:11










          • I used the answer given by Claudio Fiandrino of simply adding "" around the file name for example, includegraphics{"Example Error1".jpg}
            – user80627
            Jun 23 '15 at 3:40












          • This doesn't work for me. I'm using a filename with spaces in a for loop (ie bla 001.png, bla 002.png, bla 003.png, etc)
            – user134593
            Dec 10 '18 at 11:27



















          27














          You should also avoid other special characters like underscores in the complete path and the name of the file. But you can use the grffile package for extended file processing. For this case, just add the following line:



          usepackage{grffile}





          share|improve this answer



















          • 1




            The grffile is recommended. Another solution for spaces is enclosing the file name between ": includegraphics{"Example Error1"}, but this may break if babel is used.
            – egreg
            May 15 '12 at 23:10






          • 2




            Simply usepackage{grffile} is sufficient to fix this. Thanks!
            – Ben Voigt
            Jan 2 '13 at 15:35






          • 4




            FYI, when I used grffile for my dissertation to include many small PDF figures it took an order of magnitude longer to compile.
            – edallme
            Mar 10 '13 at 7:55










          • This works even in combination with babel and beamer!
            – Eenoku
            Jan 25 '18 at 13:11





















          6














          I found the answer while writing this since I wrote ExampleError1.jpg when doing the example image. The problem is that graphicx doesn't seem to like the spaces in the file name and it assumes it should write it. I tried writing Example Error1.jpg but it didn't like it either. The solution I propose is that write these filenames without spaces.






          share|improve this answer































            4














            The answer is simple. No need to change your existing file names or use a different package.



            Do 2 things:




            1. Use {} to encircle your file name so that includegraphics does not see the dots and spaces in your path;

            2. Use "" inside the {} so that the filename is not displayed in your pdf printout.


            Example:



            usepackage{graphicx}

            begin{document}
            begin{figure}
            includegraphics{{"../Current folder/1.This file"}.png}
            end{figure}
            end{document}


            (For Windows users,) please note that the slashes all need to be forward slashes.






            share|improve this answer



















            • 1




              Using braces is quite dangerous, because it depends, how the file name is internally parsed. A change and the curly braces will become part of the file name.
              – Heiko Oberdiek
              May 31 '18 at 17:36



















            0














            Even though you add the package graphics, you might not avoid the problem if the document class is declared as draft.



            documentclass[12pt, draft]{report}


            It is worth to remove the draft in the document class so the images will be displayed.






            share|improve this answer

















            • 1




              A global option draft can be overruled by a local package option final (usepackage[final]{graphicx}).
              – Heiko Oberdiek
              May 31 '18 at 17:39










            protected by Kurt Apr 6 '16 at 19:17



            Thank you for your interest in this question.
            Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



            Would you like to answer one of these unanswered questions instead?














            5 Answers
            5






            active

            oldest

            votes








            5 Answers
            5






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            43














            Old post, but you can do the following.



            includegraphics{"Example Error1".jpg}





            share|improve this answer



















            • 5




              This should definitely be the chosen answer.
              – LondonRob
              Jun 9 '14 at 14:11










            • I used the answer given by Claudio Fiandrino of simply adding "" around the file name for example, includegraphics{"Example Error1".jpg}
              – user80627
              Jun 23 '15 at 3:40












            • This doesn't work for me. I'm using a filename with spaces in a for loop (ie bla 001.png, bla 002.png, bla 003.png, etc)
              – user134593
              Dec 10 '18 at 11:27
















            43














            Old post, but you can do the following.



            includegraphics{"Example Error1".jpg}





            share|improve this answer



















            • 5




              This should definitely be the chosen answer.
              – LondonRob
              Jun 9 '14 at 14:11










            • I used the answer given by Claudio Fiandrino of simply adding "" around the file name for example, includegraphics{"Example Error1".jpg}
              – user80627
              Jun 23 '15 at 3:40












            • This doesn't work for me. I'm using a filename with spaces in a for loop (ie bla 001.png, bla 002.png, bla 003.png, etc)
              – user134593
              Dec 10 '18 at 11:27














            43












            43








            43






            Old post, but you can do the following.



            includegraphics{"Example Error1".jpg}





            share|improve this answer














            Old post, but you can do the following.



            includegraphics{"Example Error1".jpg}






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 5 '14 at 6:49









            Claudio Fiandrino

            52.2k11152306




            52.2k11152306










            answered May 4 '14 at 22:11









            Tyler Brabham

            54653




            54653








            • 5




              This should definitely be the chosen answer.
              – LondonRob
              Jun 9 '14 at 14:11










            • I used the answer given by Claudio Fiandrino of simply adding "" around the file name for example, includegraphics{"Example Error1".jpg}
              – user80627
              Jun 23 '15 at 3:40












            • This doesn't work for me. I'm using a filename with spaces in a for loop (ie bla 001.png, bla 002.png, bla 003.png, etc)
              – user134593
              Dec 10 '18 at 11:27














            • 5




              This should definitely be the chosen answer.
              – LondonRob
              Jun 9 '14 at 14:11










            • I used the answer given by Claudio Fiandrino of simply adding "" around the file name for example, includegraphics{"Example Error1".jpg}
              – user80627
              Jun 23 '15 at 3:40












            • This doesn't work for me. I'm using a filename with spaces in a for loop (ie bla 001.png, bla 002.png, bla 003.png, etc)
              – user134593
              Dec 10 '18 at 11:27








            5




            5




            This should definitely be the chosen answer.
            – LondonRob
            Jun 9 '14 at 14:11




            This should definitely be the chosen answer.
            – LondonRob
            Jun 9 '14 at 14:11












            I used the answer given by Claudio Fiandrino of simply adding "" around the file name for example, includegraphics{"Example Error1".jpg}
            – user80627
            Jun 23 '15 at 3:40






            I used the answer given by Claudio Fiandrino of simply adding "" around the file name for example, includegraphics{"Example Error1".jpg}
            – user80627
            Jun 23 '15 at 3:40














            This doesn't work for me. I'm using a filename with spaces in a for loop (ie bla 001.png, bla 002.png, bla 003.png, etc)
            – user134593
            Dec 10 '18 at 11:27




            This doesn't work for me. I'm using a filename with spaces in a for loop (ie bla 001.png, bla 002.png, bla 003.png, etc)
            – user134593
            Dec 10 '18 at 11:27











            27














            You should also avoid other special characters like underscores in the complete path and the name of the file. But you can use the grffile package for extended file processing. For this case, just add the following line:



            usepackage{grffile}





            share|improve this answer



















            • 1




              The grffile is recommended. Another solution for spaces is enclosing the file name between ": includegraphics{"Example Error1"}, but this may break if babel is used.
              – egreg
              May 15 '12 at 23:10






            • 2




              Simply usepackage{grffile} is sufficient to fix this. Thanks!
              – Ben Voigt
              Jan 2 '13 at 15:35






            • 4




              FYI, when I used grffile for my dissertation to include many small PDF figures it took an order of magnitude longer to compile.
              – edallme
              Mar 10 '13 at 7:55










            • This works even in combination with babel and beamer!
              – Eenoku
              Jan 25 '18 at 13:11


















            27














            You should also avoid other special characters like underscores in the complete path and the name of the file. But you can use the grffile package for extended file processing. For this case, just add the following line:



            usepackage{grffile}





            share|improve this answer



















            • 1




              The grffile is recommended. Another solution for spaces is enclosing the file name between ": includegraphics{"Example Error1"}, but this may break if babel is used.
              – egreg
              May 15 '12 at 23:10






            • 2




              Simply usepackage{grffile} is sufficient to fix this. Thanks!
              – Ben Voigt
              Jan 2 '13 at 15:35






            • 4




              FYI, when I used grffile for my dissertation to include many small PDF figures it took an order of magnitude longer to compile.
              – edallme
              Mar 10 '13 at 7:55










            • This works even in combination with babel and beamer!
              – Eenoku
              Jan 25 '18 at 13:11
















            27












            27








            27






            You should also avoid other special characters like underscores in the complete path and the name of the file. But you can use the grffile package for extended file processing. For this case, just add the following line:



            usepackage{grffile}





            share|improve this answer














            You should also avoid other special characters like underscores in the complete path and the name of the file. But you can use the grffile package for extended file processing. For this case, just add the following line:



            usepackage{grffile}






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Sep 9 '15 at 12:41









            galgalesh

            1073




            1073










            answered Oct 14 '10 at 15:47









            Thorsten Donig

            36.3k590119




            36.3k590119








            • 1




              The grffile is recommended. Another solution for spaces is enclosing the file name between ": includegraphics{"Example Error1"}, but this may break if babel is used.
              – egreg
              May 15 '12 at 23:10






            • 2




              Simply usepackage{grffile} is sufficient to fix this. Thanks!
              – Ben Voigt
              Jan 2 '13 at 15:35






            • 4




              FYI, when I used grffile for my dissertation to include many small PDF figures it took an order of magnitude longer to compile.
              – edallme
              Mar 10 '13 at 7:55










            • This works even in combination with babel and beamer!
              – Eenoku
              Jan 25 '18 at 13:11
















            • 1




              The grffile is recommended. Another solution for spaces is enclosing the file name between ": includegraphics{"Example Error1"}, but this may break if babel is used.
              – egreg
              May 15 '12 at 23:10






            • 2




              Simply usepackage{grffile} is sufficient to fix this. Thanks!
              – Ben Voigt
              Jan 2 '13 at 15:35






            • 4




              FYI, when I used grffile for my dissertation to include many small PDF figures it took an order of magnitude longer to compile.
              – edallme
              Mar 10 '13 at 7:55










            • This works even in combination with babel and beamer!
              – Eenoku
              Jan 25 '18 at 13:11










            1




            1




            The grffile is recommended. Another solution for spaces is enclosing the file name between ": includegraphics{"Example Error1"}, but this may break if babel is used.
            – egreg
            May 15 '12 at 23:10




            The grffile is recommended. Another solution for spaces is enclosing the file name between ": includegraphics{"Example Error1"}, but this may break if babel is used.
            – egreg
            May 15 '12 at 23:10




            2




            2




            Simply usepackage{grffile} is sufficient to fix this. Thanks!
            – Ben Voigt
            Jan 2 '13 at 15:35




            Simply usepackage{grffile} is sufficient to fix this. Thanks!
            – Ben Voigt
            Jan 2 '13 at 15:35




            4




            4




            FYI, when I used grffile for my dissertation to include many small PDF figures it took an order of magnitude longer to compile.
            – edallme
            Mar 10 '13 at 7:55




            FYI, when I used grffile for my dissertation to include many small PDF figures it took an order of magnitude longer to compile.
            – edallme
            Mar 10 '13 at 7:55












            This works even in combination with babel and beamer!
            – Eenoku
            Jan 25 '18 at 13:11






            This works even in combination with babel and beamer!
            – Eenoku
            Jan 25 '18 at 13:11













            6














            I found the answer while writing this since I wrote ExampleError1.jpg when doing the example image. The problem is that graphicx doesn't seem to like the spaces in the file name and it assumes it should write it. I tried writing Example Error1.jpg but it didn't like it either. The solution I propose is that write these filenames without spaces.






            share|improve this answer




























              6














              I found the answer while writing this since I wrote ExampleError1.jpg when doing the example image. The problem is that graphicx doesn't seem to like the spaces in the file name and it assumes it should write it. I tried writing Example Error1.jpg but it didn't like it either. The solution I propose is that write these filenames without spaces.






              share|improve this answer


























                6












                6








                6






                I found the answer while writing this since I wrote ExampleError1.jpg when doing the example image. The problem is that graphicx doesn't seem to like the spaces in the file name and it assumes it should write it. I tried writing Example Error1.jpg but it didn't like it either. The solution I propose is that write these filenames without spaces.






                share|improve this answer














                I found the answer while writing this since I wrote ExampleError1.jpg when doing the example image. The problem is that graphicx doesn't seem to like the spaces in the file name and it assumes it should write it. I tried writing Example Error1.jpg but it didn't like it either. The solution I propose is that write these filenames without spaces.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 15 '12 at 23:24









                Werner

                438k649601652




                438k649601652










                answered Oct 14 '10 at 15:44









                ThorDivDev

                318137




                318137























                    4














                    The answer is simple. No need to change your existing file names or use a different package.



                    Do 2 things:




                    1. Use {} to encircle your file name so that includegraphics does not see the dots and spaces in your path;

                    2. Use "" inside the {} so that the filename is not displayed in your pdf printout.


                    Example:



                    usepackage{graphicx}

                    begin{document}
                    begin{figure}
                    includegraphics{{"../Current folder/1.This file"}.png}
                    end{figure}
                    end{document}


                    (For Windows users,) please note that the slashes all need to be forward slashes.






                    share|improve this answer



















                    • 1




                      Using braces is quite dangerous, because it depends, how the file name is internally parsed. A change and the curly braces will become part of the file name.
                      – Heiko Oberdiek
                      May 31 '18 at 17:36
















                    4














                    The answer is simple. No need to change your existing file names or use a different package.



                    Do 2 things:




                    1. Use {} to encircle your file name so that includegraphics does not see the dots and spaces in your path;

                    2. Use "" inside the {} so that the filename is not displayed in your pdf printout.


                    Example:



                    usepackage{graphicx}

                    begin{document}
                    begin{figure}
                    includegraphics{{"../Current folder/1.This file"}.png}
                    end{figure}
                    end{document}


                    (For Windows users,) please note that the slashes all need to be forward slashes.






                    share|improve this answer



















                    • 1




                      Using braces is quite dangerous, because it depends, how the file name is internally parsed. A change and the curly braces will become part of the file name.
                      – Heiko Oberdiek
                      May 31 '18 at 17:36














                    4












                    4








                    4






                    The answer is simple. No need to change your existing file names or use a different package.



                    Do 2 things:




                    1. Use {} to encircle your file name so that includegraphics does not see the dots and spaces in your path;

                    2. Use "" inside the {} so that the filename is not displayed in your pdf printout.


                    Example:



                    usepackage{graphicx}

                    begin{document}
                    begin{figure}
                    includegraphics{{"../Current folder/1.This file"}.png}
                    end{figure}
                    end{document}


                    (For Windows users,) please note that the slashes all need to be forward slashes.






                    share|improve this answer














                    The answer is simple. No need to change your existing file names or use a different package.



                    Do 2 things:




                    1. Use {} to encircle your file name so that includegraphics does not see the dots and spaces in your path;

                    2. Use "" inside the {} so that the filename is not displayed in your pdf printout.


                    Example:



                    usepackage{graphicx}

                    begin{document}
                    begin{figure}
                    includegraphics{{"../Current folder/1.This file"}.png}
                    end{figure}
                    end{document}


                    (For Windows users,) please note that the slashes all need to be forward slashes.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Apr 14 '16 at 5:28

























                    answered Apr 14 '16 at 5:23









                    Argyll

                    504313




                    504313








                    • 1




                      Using braces is quite dangerous, because it depends, how the file name is internally parsed. A change and the curly braces will become part of the file name.
                      – Heiko Oberdiek
                      May 31 '18 at 17:36














                    • 1




                      Using braces is quite dangerous, because it depends, how the file name is internally parsed. A change and the curly braces will become part of the file name.
                      – Heiko Oberdiek
                      May 31 '18 at 17:36








                    1




                    1




                    Using braces is quite dangerous, because it depends, how the file name is internally parsed. A change and the curly braces will become part of the file name.
                    – Heiko Oberdiek
                    May 31 '18 at 17:36




                    Using braces is quite dangerous, because it depends, how the file name is internally parsed. A change and the curly braces will become part of the file name.
                    – Heiko Oberdiek
                    May 31 '18 at 17:36











                    0














                    Even though you add the package graphics, you might not avoid the problem if the document class is declared as draft.



                    documentclass[12pt, draft]{report}


                    It is worth to remove the draft in the document class so the images will be displayed.






                    share|improve this answer

















                    • 1




                      A global option draft can be overruled by a local package option final (usepackage[final]{graphicx}).
                      – Heiko Oberdiek
                      May 31 '18 at 17:39
















                    0














                    Even though you add the package graphics, you might not avoid the problem if the document class is declared as draft.



                    documentclass[12pt, draft]{report}


                    It is worth to remove the draft in the document class so the images will be displayed.






                    share|improve this answer

















                    • 1




                      A global option draft can be overruled by a local package option final (usepackage[final]{graphicx}).
                      – Heiko Oberdiek
                      May 31 '18 at 17:39














                    0












                    0








                    0






                    Even though you add the package graphics, you might not avoid the problem if the document class is declared as draft.



                    documentclass[12pt, draft]{report}


                    It is worth to remove the draft in the document class so the images will be displayed.






                    share|improve this answer












                    Even though you add the package graphics, you might not avoid the problem if the document class is declared as draft.



                    documentclass[12pt, draft]{report}


                    It is worth to remove the draft in the document class so the images will be displayed.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered May 31 '18 at 17:18









                    ClickBright

                    212




                    212








                    • 1




                      A global option draft can be overruled by a local package option final (usepackage[final]{graphicx}).
                      – Heiko Oberdiek
                      May 31 '18 at 17:39














                    • 1




                      A global option draft can be overruled by a local package option final (usepackage[final]{graphicx}).
                      – Heiko Oberdiek
                      May 31 '18 at 17:39








                    1




                    1




                    A global option draft can be overruled by a local package option final (usepackage[final]{graphicx}).
                    – Heiko Oberdiek
                    May 31 '18 at 17:39




                    A global option draft can be overruled by a local package option final (usepackage[final]{graphicx}).
                    – Heiko Oberdiek
                    May 31 '18 at 17:39





                    protected by Kurt Apr 6 '16 at 19:17



                    Thank you for your interest in this question.
                    Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                    Would you like to answer one of these unanswered questions instead?



                    Popular posts from this blog

                    How to change which sound is reproduced for terminal bell?

                    Can I use Tabulator js library in my java Spring + Thymeleaf project?

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents