The Malaysian flag is called the Jalur Gemilang (“Stripes of Glory”). Ramón has been drawing a lot of flags/signs with TikZ, and here’s his great effort with Jalur Gemilang!
You can find many other flags drawn by Ramón here.
The Malaysian flag is called the Jalur Gemilang (“Stripes of Glory”). Ramón has been drawing a lot of flags/signs with TikZ, and here’s his great effort with Jalur Gemilang!
You can find many other flags drawn by Ramón here.
The title says it all! This was asked recently on TeX.SX, and this answer from percusse has the scoop. The main idea is to use decorations for the lines in TikZ. Here’s his output (requires LuaLaTeX or XeLaTeX to use the font):
LaTeX-Community has teamed up with Packt Publishing to hold a LaTeX and Graphics contest, where participants can write about anything related to graphics. There are 10 superb contributions, jam-packed with lots of things to take away. Readers can now vote/share/like/blog/comment on the entries, while the judges deliberate over the 2 winners.
My entry is about a technique for efficiently creating visually non-repeating tiled pattern backgrounds, while using only small-sized graphics files, which I’ll cross-post here eventually I suppose, after the contest has ended.
This post answers the question
So how do I create high-resolution line drawings for use in LaTeX? Journal publishers request PDF or EPS with at least 800dpi.
Najmi’s post on Drawing diagram; the cryptic way covered tikz, ditaa and graphviz. (I myself swear by tikz.) However these may be too geeky for most people’s tastes. So here’s a list of free, open source, GUI-based diagramming applications that can produce PDF or EPS files.
Recently I was asked this question by not 1, but 3 people, so I guess that makes for a valid blog post!
I’m now migrating my paper/presentation to LaTeX from Microsoft Word/Powerpoint. It feels great! But is there any way I can transfer my existing line drawings over as high-resolution PDF or EPS? The publisher is asking for 800-1200 dpi.
Of course you can. I’ll outline what has worked for me below.
As for the question
So how do I create high-resolution line drawings for use in LaTeX if not the drawing tools in Word?
See the posts on Diagramming Applications and Drawing diagram; the cryptic way instead.
If you’re on a Mac, first print your drawing diagram as a PDF. Open the PDF in Preview. Click the Select button on the Toolbar, and draw a rectangle around your drawing diagram. Then go to Tools menu and select Crop, or just hit Command-K. Save your cropped drawing back as a PDF.
If you have OpenOffice, you can try copying-and-pasting your drawing objects over to OpenOffice Draw, change the page size (Format > Page…) to fit the drawing just right, then export the drawing to PDF. However, elements and formattings often get distorted when copied over to OODraw, so personally I’d go for the procedures described next.
Disclaimer: The tools described in this section are mainly for use in Windows, and are free-of-charge, but not all are open source.
Big thanks to Kevin Klement for pointing me toward PDFCreator and BRISS, true FOSS solutions!
Convert Your Drawing to PDF
First get PDFCreator. Once installed, you will be able to produce PDF out of any documents that is printable.
In your Word or Powerpoint document, select/highlight your line drawing, and go to File > Print. Choose “PDFCreator” as your printer, and select “Selection” or (“Current Page”) as the page range. You should also open the Print Properties, click on the Advanced button, and make sure that Print Quality is set to a sufficiently high dpi (e.g. 1200).
Click OK to print, and you will be prompted to enter any metadata (author, title, etc) you would like about the PDF. Save the PDF. You now have a high-resolution line drawing PDF, but it needs to be cropped to remove the surrounding white space.
First, install PDF995. You’ll need the 2 files from Pdf995 2-Step Download, i.e. the “Printer Driver” and the “Free Converter”. (A warning though: PDF995 is adware.)
In your Word or Powerpoint document, select/highlight your line drawing, and go to File > Print. Choose “PDF995” as your printer, and select “Selection” as the page range.
When you click OK you will be asked to enter a file name to save your PDF to. Bear with the annoying advertisement that pops up for 10 seconds.
Cropping Your PDF
You have a few choices.
briss-.jar
to launch. Load your diagram drawing PDF file, and draw a rectangle around the drawing objects. Click Crop PDF, and you’re done after saving the file.(Theoretically, you can use the GhostScript on command line to crop your PDF, but that involves figuring out the crop box and margins yourself, which I suspect not many people enjoy. Hence PDF-copper.)
In PDF-cropper, go to the Configure menu and set the path to GhostScript binaries (usually C:\Program Files\GS\GS8.6x\bin
), as well as your fixed output folder. Now load all your PDF files containing your drawings (PDF-cropper processes them by batch.) You can choose to crop off all surrounding white space around your drawings, or leave 5mm or 10mm space around them. Click the Action button, and the automatically cropped PDFs will be saved in the fixed output folder you specified.
Congratulations, you should now have high-resolution line drawings in PDF (or EPS) format, that are suitable for journal publication. Now just to include them in your LaTeX file with \includegraphics[width=...]{filename}
.
Happy Chinese New Year! Well traditionally CNY is celebrated up till the 15th day, so this isn’t a belated greeting. 😉
I thought my post on the front and back covers (+ISBN bar codes) was the last thing I wanted to document in the bookdesign series, but I just realised that I’d still yet to talk about producing a CMYK version if your printer is using a offset-printing process.
You can read about the CMYK colour model and how it it’s different from RGB. In a nutshell, RGB is for on-screen viewing and is more vibrant, CMYK is for commercial printing and seems more “dull”. Check with your printing service if they’re using (on-demand) laser printing or offset-printing to print your material; it may depend on the type of printing stock (i.e. the paper) you choose.
If laser printing is used, RGB is fine, and you can hand over your pdflatex-generated file over as it is. However if offset-printing is to be used, you’ll need to produce your PDF in CMYK colour model instead. Your printing service might be willing to do the conversion for you at their end; but I think it’s more efficient to do this yourself as you’ll have more control over the final PDF. It’ll also give you a more accurate idea of how your design will look in print, so you’ll have a chance of selecting your colours.
Any graphic files that you include (via \includegraphics, for example) must be converted to CMYK. If you have imagemagick, the quick way is
convert image_RGB.jpg -colorspace CMYK image_CMYK.jpg
But I’ve been told that the resulting PDF, when loaded into other applications e.g. Illustrator, contains the “wrong” colours. For more accurate results, you’ll need to use colour profiles as discussed here.
By default, the xcolor package uses the RGB colour model. To invoke CMYK mode:
And then there’s the issue of different kinds of black. If your design contains large areas of black, and particularly if it involves light-coloured text (e.g. white) on a black background, the RGB black directly converted to CMYK would have values of C: 100% M: 100% Y: 100% K: 100% (over-saturated rich black). You then run high risks of getting unwanted “shadows” if the four colours print out of registration, as shown in the sample on the right from this excellent article:
Now the cmyk mode of the xcolor package automatically redefines the colour black to C: 0% M: 0% Y: 0% K: 100%, i.e. flat or standard black. Flat black can look rather “washed-out”, so you might want to define a different shade of black, especially for large areas of black. Check with your printing service for further advice. E.g. our printer recommended to use a “cool black” C: 30% M: 0% Y: 0% K: 100% for the covers of our Grid Computing Cluster book. Unfortunately I couldn’t figure out how to do it previously, but now I do:
%% cmyk values have range [0,1]
\definecolor{CoolBlack}{cmyk}{.3,0,0,1}
%% In case you want to redefine the basic black
%% (0,0,0,1) across the board. Check with your
%% printer if this is advisable!!
\definecolor{black}{cmyk}{.4,.3,.3,1}
%% Force the new black into effect, because
%% xcolor issues \color{black} with the old
%% black before all its initialisations.
\color{black}
In other words, you should always liaise with your printing service concerning the technical specs. You’ll thank them for their expert advice, and you’ll learn a lot about graphics design and the printing process as well.
OK that’s it! That’s truly the last of the bookdesign series. I hope you’ve enjoyed it as much as I did.
A brief departure from the bookdesign series, as some of my future posts within and outside the series will be dealing with the use of colours, so I might as well get it out of the way first. Summarily, we’ll take a look at how to use colours in LaTeX with the xcolor package. This will work with all outputs, i.e. .dvi, .ps and .pdf.
The most useful commands for applying colours made available by xcolor are:
See Section 2.6 of the xcolor manual for full list and more details of commands for colour application. Alternatively, if you’re using emacs, you can look it up with M-x list-colors-display.
The xcolor package has quite a collection of pre-defined colours; they are listed in Section 4 Colors by Name in the manual. Apart from the 19 “base” colours that are always available, you can also access more pre-defined colours via the dvipsnames, svgnames and x11names options. Here’s a quick example:
\begin{document}
% ‘LemonChiffon1’ from x11names
\pagecolor{LemonChiffon1}
% ‘magenta’ is a base colour
\textcolor{magenta}{Hello World!}
% ‘CadeBlue1’, ‘Firebrick2’ and ‘Goldenrod1’
% are available via x11names
What a \colorbox{CadetBlue1}{wonderful}
\fcolorbox{Firebrick2}{Goldenrod1}{world}.
\end{document}
You can mix up your own colours, too. \color{LemonChiffon1!80} means 80% LemonChiffon1 and 20% white, while \color{lime!30!yellow!60!Mahogany} would be 30% lime, 60% yellow, and 10% Mahogany. You can also give names to the colours you concoct, so that you can reuse them at various points in your document. For example:
If you’re like me i.e. you just can’t hit the right figures to get a colour just right, head over to COLOURlovers for lotsa inspirations and colour schemes. I got almost all my colours for the Grid Computing Cluster report from this website.
Have fun and happy LaTeXing!
I’m sure every LaTeX user tried this code at least once to add a “background image” on a page:
\includegraphics[width=\pagewidth,height=\textwidth]{wallpaper_filename}
But the included graphics, even though it looks the right size, would refuse to budge beyond the page margins, leaving a white border all round it. And you’d probably have problem placing any text at all on the graphics, thus defeating the purpose of a “background” image.
The wallpaper package offers an easy way to add background images or wallpapers in LaTeX, including tiling. The following commands are available:
For tiling wallpapers, there are:
Note that all the commands above will apply the background images on every page after the command is issued. To clear the wallpaper, use \ClearWallPaper.
Also, for each command \XXXWallPaper command above, there is a \ThisXXXWallPaper command that takes the same arguments but would apply the background image on only the current page.
You can now run wild with your imagination to design letterheads, chapter headings, covers, etc. Have fun!
I managed to tried out 3 applications:
%modified from texample.net
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{mindmap,trees}
\usepackage{verbatim}\begin{document}
\pagestyle{empty}\begin{tikzpicture}
\path[mindmap,concept color=red!50!black,text=white]
node[concept] {Hidup}
[clockwise from=0]
child[concept color=green!60!blue]
{
node[concept] {Pertimbangan}
[clockwise from=90]
child { node[concept] {cari duit} }
child { node[concept] {buat amal ibadat} }
child { node[concept] {belajar sungguh-sungguh} }
child { node[concept] {bina keluarga bahagia} }
}
child[concept color=orange] {
node[concept] {research}
[clockwise from=-30]
child { node[concept] {jurnal} }
child { node[concept] {artikel} }
};
\end{tikzpicture}\end{document}
will produce
then how about ditaa;
Raw source snapshot:
Source, the “dot” file:
digraph process{
node [color=blue,fontcolor=black,font=helvetica,]
nodesep=1.5
A[label=”Machine Object (MO)”]
B[label=”Portable Object (PO)”]C[label=”developer”]
D[label=”translator”]
E[label=”tools”]
F[label=”POedit”]
G[label=”kbabel”]C->B[label=”prepares PO”,style=dashed]
C->A[label=”compiles MO”,style=dashed]
C->B->D [label=”send PO files/i18n”,fontcolor=red]
D->B->C[label=”return translated files/l10n”,fontcolor=green ]
D->E[label=”translate using”,fontcolor=blue,style=dashed]
E->F
E->G
}
returns;
Oops — I forgot to thank the blog owner najmi for inviting me to be an author! How unbecoming of me! *grovel* Thanks again! 🙂
For quite some time now, the graphicx
package would automatically sort out which file types to use whenever it encounters \includegraphics{some_file}
, where the extension of some_file
is not specified.
That is to say, if you are generating to a .dvi
, the system would look for some_file.eps
. If you are generating to a .pdf
, it looks for some_file.{pdf|jpg|png}
.
But what if you want a .pdf
and you work with .pdf, .jpg and .png graphic files, but suddenly you received a .eps graphics from your collaborator? (This actually happened to a lecturer at my university.)
Well, you could always convert it manually to a .pdf yourself with GhostScript or GIMP, of course. But now the process can be automated if you’re using MikTeX 2.8 or TeXLive 2009, as highlighted by Rob Hyndman.
In MikTeX 2.8, use the epstopdf
package together with graphicx
, like so:
\documentclass{article}\usepackage{graphicx,epstopdf}\begin{document}\includegraphics[width=\textwidth]{some_file}\end{document}
If all you have is some_file.eps
, it will be automatically converted to a some_file-eps-converted-to.pdf
during the first time the LaTeX document is compiled and included in the final document output.
If you’re using TeXLive 2009, you don’t even have to load epstopdf
explicitly, but I say include it anyway, for portability’s sake.