Reputation
4,202
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
10 27
Newest
 Nice Answer
Impact
~70k people reached

1h
asked why pdfcrop fails with pdfTeX run failed with value 1! on some files? TL 2015
21h
accepted How to check that image has valid size before `\includegraphics` is called?
1d
comment How to check that image has valid size before `\includegraphics` is called?
I thought it will go over multiple pages, and I just needed to check. I had no idea how it will work with such large image. pdflatex said pdfTeX warning: pdflatex (file ./image.pdf): PDF inclusion: multiple pdfs with page group included in a single page so this is OK. I wanted it to fit on one page. thanks.
1d
comment How to check that image has valid size before `\includegraphics` is called?
I just tried your solution and the image does show on only ONE page, which is great! that is what I want.
1d
comment How to check that image has valid size before `\includegraphics` is called?
Thanks. There are few images out of over 55,000 images that have this problem. Most are small and cause no problem. Also pdf allows zooming so one can zoom to see the image if needed. The point is not to break the compilation each time new images are generated. So your solutions allows me to compile the pdf and not have to worry about breaking the build. But I would need it to fit to one page as before, even if it become too smal to see. But will try and see.
1d
accepted Dimension too large. error from pdflatex when using \includegraphics
1d
revised Dimension too large. error from pdflatex when using \includegraphics
added info
1d
comment Dimension too large. error from pdflatex when using \includegraphics
The issue not for latex to "correct" anything. The issue is to provide the means for the user to check if they want to load the image or not. This is called defensive programming. I should be able to write a Latex document that handle any size images by adding checks. If the image is too large, I will not load it. Now my Latex document is robust and will compile all the time. I can replace the image by a message saying image too large to include. Any way, I opened new question on this topic so this discussion may be belong to there.
1d
revised How to check that image has valid size before `\includegraphics` is called?
added
1d
comment Dimension too large. error from pdflatex when using \includegraphics
These are Mathematica graphics, exported to pdf using Mathematica Export. From design point of view, it is better to have the program trying to load the pdf to check if it can do it not, than trying to figure how to make Mathematica only export pdf files that Latex can load. May be later I want to use these pdf files by another program than can read them? Also it is hard to map Mathematica graphics sizes to what will show up as in pdf after export.
1d
asked How to check that image has valid size before `\includegraphics` is called?
1d
revised Dimension too large. error from pdflatex when using \includegraphics
added
1d
comment Dimension too large. error from pdflatex when using \includegraphics
This is all automated. I need a way in Latex to check if the image can be loaded correctly before issuing the includegraphics command so that my build does not fail in the middle. I can't open each image manually and check its size one by one.
1d
comment Dimension too large. error from pdflatex when using \includegraphics
Thanks. Is there a way to check for this in Latex before loading the image? I have thousands of such images, generated automatically and I do not know what size they will come out as. I need a way to check then if the image is too large and not include, else the build will fail. Most the images are small, but few, due to the computation, can show up this large.
1d
comment Dimension too large. error from pdflatex when using \includegraphics
@ChristianHupfer I have thousands of such pdf image files created by Mathematica. I use Mathematica Export command. Few of them are too large and give such error. The question here is., why pdflatex gives an error? Is there a limit somewhere in pdf that one should know about?
1d
revised Dimension too large. error from pdflatex when using \includegraphics
added another example
1d
asked Dimension too large. error from pdflatex when using \includegraphics
Jul
24
accepted Can a command be defined to have key=value in it?
Jul
24
comment Can a command be defined to have key=value in it?
@cfr I do not know what "expansion" exactly mean in Latex world. Is it like Latex is trying to evaluate the command before it is applied to the \includegraphics part? something like this may be. I do not know, that is why I am asking.
Jul
24
asked Can a command be defined to have key=value in it?