Hot answers tagged

163

The order of preference when files with the same name and different extensions is .png .pdf .jpg .mps .jpeg .jbig2 .jb2 .PNG .PDF .JPG .JPEG .JBIG2 .JB2 which is stored in the macro \Gin@extensions. So if you have both image.png and image.pdf, pdflatex will load the former. If you are mixing case in extensions, then \DeclareGraphicsExtensions{% ...


75

The DVI producing latex doesn't support reading the size of PNG, JPG or PDF images. You need to use pdflatex for this. Actually latex is pdflatex in DVI mode in modern distributions, but it can read the sizes only in PDF mode for some reason. You are however able to state the natural size of the images using natwidth and natheight which will make latex ...


68

Formats that work with LaTeX (dvi mode, using dvips): eps Formats that work with LaTeX (dvi mode, using dvipdfm(x)): pdf png jpeg eps Formats that work with pdfLaTeX (pdf mode): pdf png jpeg jbig2 LuaTeX can also read jpeg 2000 TeX Live since 2010 will automatically convert eps files to pdf format. This can currently be done if you include ...


45

Answering my own question after much research, experimentation, and testing. stevem's pointer to to the Mac OS X TeX Toolbox approach (store the TeX snippet in a box and write the height, width, and depth to a file) was the crucial key to the puzzle. I followed that approach, made some adjustments and additions, and came up with a solution that is not only ...


29

Nowadays everything is actually very simple. In essence, you only need to worry about three different file formats: PDF for vector graphics JPEG for photos PNG for other kinds of raster graphics. pdflatex supports all of these, and virtually any graphics file can be converted to one of these formats. And pdflatex not only supports these, but it does it ...


28

A pragmatic solution would be to just have two subdirectories with illustrations, pics and draftpics, where in draftpics you store the low-res png's. If you use a variable like: \def \picsdir {draftpics} You can refer to this variable when including them using includegraphics: \includegraphics[width=\textwidth]{\picsdir/spam} At the end you only need ...


28

The newest libpng update (1.6.2 I believe?) has stricter rules about iCCP and will print this warning every time it finds a png that is broken. This warning can be ignored. Fixes would include: Downgrade to a older version of libpng Install imagemagick and convert all .png files with convert -strip (script below) Maybe even just disable this warning? In ...


22

You can use the standalone class which will produce a pdf with no border. If you want a small border you can add [border=<length>] class option. Notes: As LionelMANSUY mentioned in the comments it is usually preferable to use keepaspectratio, but if specific dimensions of both height and width are required, using `keepaspectratio may conflict with ...


22

Disclaimer: I'll try to write a technical explanation of what I found, but I'm not versed in those image witchcrafts. Please bear with me. :) This is just a partial answer. I have no idea of the impact of such formats when processed by pdfTeX. EDIT: See Patrick's answer. Just to make our lives easier, I'll name the images: The "normal" one: subject1.png ...


20

This is just an effect of the display settings of your PDF viewer. In Acrobat Reader 9, for example, there is an option "Edit | Preferences | Page Display | Smooth images". If you uncheck this box, the picture will not be anti-aliased. When printing, your image should look fine regardless of the smoothing effect you see on screen. Here's your file in ...


20

Hartmut Henkel states these conditions in a mail on the context mailing list: non-interlaced no palette no transparency no gamma coming with it no gamma modification requested no white adjustment in the PNG and a few more rare others. He also states: These are about the factors affecting the PNG to PDF size. For your big PNG graphic you may find a ...


17

standalone class is sufficient. You can enable the multi option, so that the contents of each (math) environment is cropped to its own page in a PDF file. Then you can either save each page directly as a .png image (Acrobat Pro, and perhaps Adobe Reader, allows you to do it in one go), or you can use the convert functionality (need Image Magick) provided ...


16

Me personally, I make a poor copy of the .pdf graphics and use these, just when I'm finished I switch to the high-quality ones. I don't know whether there's an automated LaTeX gadget for that. My solution in bash (Unix systems) I have the full .pdf images stored in sub-directory full_images. Using the following script I convert them to preview quality: ...


16

This is not an answer to the question as asked, but I think it may be of use to those trying to work out which format to use and how to select it. If you are using the graphicx package and your intention is to be flexible (in that you want to be able to produce different output formats from the same source file) then there is a simple way to avoid having to ...


16

LaTeX graphics packages LaTeX and its graphics packages do not touch the image data. TeX does not even provide the reading of binary data. Thus LaTeX passes the image as file name reference to the driver. Also most of the drivers are not image processing programs. They only move the image data in a form appropriate for the output format. For example, dvips ...


14

You can use the TikZ external library to automatically generate PNGs of your tikzpictures. The style \tikzset{ png export/.style={ external/system call={ pdflatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"; convert -density 300 -transparent white "\image.pdf" ...


12

Age! None of these standards were around when TeX was developed. As a matter of fact there were only dot matrix printers! As Knuth - wisely - in my opinion - decided to freeze the development of TeX and concentrate in making it better and bug free, these were added much later via the special command by packages such as graphicx.


12

To strip all .png files with ImageMagick, you can simply run the following command find . -type f -name "*.png" -exec convert {} -strip {} \;


11

Media size (SRA3): 320mm x 450mm Image size: 5400px x 3850px Media or image needs to be rotated to prevent severe distortion of the image (keepaspectratio=false) or larger margins (keepaspectratio=true). Package geometry can be used to set the paper size and package pdfpages also works with images. If the image is rotated, then package pdflscape tells the ...


10

The DPI measure the displayed number of Dot Per Inch. If you increase the DPI, it is normal that your picture dimensions will decrease at the same scale. You do not need to change the DPI, you should insert your image like this: \includegraphics[width=Xcm]{file.png} to have a picture of a width equal to Xcm (height automatically adjusted, or height=Xcm). ...


10

Using ImageMagick: convert -density 300x300 simplenetwork02_stack.pdf -transparent white simplenetwork02_stack.png To have just the PSTricks graphic as output, add \usepackage[tightpage,active]{preview} \PreviewEnvironment{pspicture} to the preamble. You may want to adjust the pspicture size to get a tightly boxed graphic: \begin{pspicture}*(0,0)(6,7) ...


10

Here is a startpoint. You can continue writing... Code: \documentclass[10pt,landscape]{article} \usepackage{multicol} \usepackage{array} \newcolumntype{L}{>{\ttfamily\color{red!50}}l} \usepackage[landscape]{geometry} \geometry{paperwidth=508mm,paperheight=286mm,top=1cm,left=3cm,right=3cm,bottom=1cm} \usepackage{xcolor} \pagecolor{black} ...


10

Plotting heatmaps with gnuplot and LaTeX with small file size Basically, there are two different ways to draw heatmaps with gnuplot: Plotting with image Plotting with pm3d and splot Both have their advantages and disadvantages, and which one should use also depends on the actual data structure. The following terminals allow typesetting text with LaTeX ...


9

Have a look at the ideas at The baseline problem corrected. They have been incorporated into mathTeX vertical alignment if you want to use mathTeX to create the images.


9

The graphics formats that you can use depend on the graphics driver not on (pdf)LaTeX: As others have said pdfLaTeX in pdf-mode can use pdf, png, jpg, and mps. LaTeX in dvi-mode and dvips as driver can use eps (and mps). LaTeX in dvi-mode and dvipdfmx as driver can use eps (and mps), pdf, png, and jpg if you provide information about the bounding box and ...


9

I do the exact thing all the time, and it always looks good. Perhaps it is the pdf viewer that renders it badly? (I use xpdf mostly.) Maybe you can post screenshots of the image, and how it looks in the pdf document?


8

You have to convert your DVI file to PS using dvips -I c <filename> instead of just dvips <filename> (http://www.win.tue.nl/latex/faq.html#q16). The -I switch is used to select image options, the c stands for color, grayscale would be g (http://docs.miktex.org/manual/dvips.html).


8

The image file poker.png has a poor resolution. The cropped text has 90 × 56 pixels only. The resolution is 72 DPI, This is not suitable for printing unless it is scaled down. The PDF specification knows a key Interpolation for bitmap images: Image Interpolation When the resolution of a source image is significantly lower than that of the ...


8

Install inkscape2tikz. The following example is taken from inkscape2tikz home page. Using inkscape2tikz we export this in to tikz code: \documentclass{article} \usepackage{tikz} \usepackage{charter} %%%% Added for demo of fonts \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \begin{document} ...


8

If you use the command latex (making dvi) you need to specify the natural size the image natwidth=... natwidth=... (not width= as that tries to scale to that size but still needs the natural size. If you use the command pdflatex (making pdf directly) Then the system can read the file and determine its natural size automatically. In either case it is ...



Only top voted, non community-wiki answers of a minimum length are eligible