I have tried to search, but I have not been able to found any repository with the flags of the most common countries defined with TikZ. It must be very possible as most flags are really vectors.
-
2Not that I know of, but you could take an SVG rendering (say, from here: bastisoft.de/misc/flags) and convert it to TikZ.– Andrew StaceyMay 18, 2011 at 12:06
-
@Andrew Stacey: Great idea and link, thanks! On a sidenote, sadly Brazil is not in that flag list. =P– Paulo CeredaMay 18, 2011 at 12:25
-
@Paulo: In that case, if anyone wants to do a "proof of concept" here then they should do the Brazilian flag! (I got as far as "Denmark" before I stopped looking.)– Andrew StaceyMay 18, 2011 at 12:39
-
7@Andrew: Wikimedia has Denmark and Brazil: commons.wikimedia.org/wiki/Category:SVG_sovereign_state_flags– JakeMay 18, 2011 at 12:45
-
@Jake: I bow to your superior searching skills. I got the following page from Wikipedia when I searched: en.wikipedia.org/wiki/Category:SVG_flags– Andrew StaceyMay 18, 2011 at 12:47
4 Answers
Update
Sadly, this solution no longer works (as of TeX Live 2015). In the change history of minitoc
:
2015/07/13
- Jean-Pierre F. Drucbert passed away in 2009. So this package is now looking for a maintainer.
- Reduce size of documentation, by eliminating flags and other images, from 25+mb to less than 2mb.
You can retrieve the original version of the documentation from the TeXLive historic archive here.
Original answer
The astonishingly bizarre documentation for the minitoc
package has done most of the work for you. (Although with .png
images.) So for any flag you can think of the following will work: (You can also find maps as well.)
\documentclass{article}
\usepackage{graphicx}
% change the year to match your current distribution up to 2014
\graphicspath{{/usr/local/texlive/2010/texmf-dist/doc/latex/minitoc/}}
\begin{document}
\includegraphics[width=.3\textwidth]{brazil-f}
\includegraphics[width=.3\textwidth]{vanuatu-f}
\includegraphics[width=.3\textwidth]{belarus-f}
\end{document}
Just for entertainment, here are the flags of Brazil, Vanuatu, and Belarus.
-
16
-
1Note: This won’t work with MiKTeX – for two reasons: especially for this package the flag files are not included in minitoc’s documentation directory, and generally the whole documentation subtree is unfortunately not included into the filename database. One could, of course, install all missing files in a local texmf tree and then give the absolute path or use
\graphicspath
– or put the needed files into the document directory.– SperavirNov 6, 2012 at 3:20 -
5 interesting flags: Poland, Indonesia, Monaco, Austria, and Peru. Nov 6, 2012 at 4:21
-
1@pasbi No it doesn't. The package was changed in 2015 and all the flags were removed. I've updated the answer. May 27, 2019 at 12:59
-
1@pasbi There is a new package, now. See my answer: tex.stackexchange.com/a/594051/101651– CarLaTeXApr 22, 2021 at 19:52
Now (April 2021) there is!
Wilhelm Haager created the package worldflags
.
Here some examples:
\documentclass{article}
\usepackage{worldflags}
\begin{document}
\begin{center}
Standard flags
\worldflag{IT}
\worldflag{BR}
\worldflag{AD}\vspace{10pt}
Flags with special dimensions
\worldflag{CH}
\worldflag{GB}
\worldflag{VA}\vspace{10pt}
There are also some options
(for the complete list see the package documentation)
\worldflag[length=3cm]{EU}
\worldflag[grid]{UNO}
\worldflag[noemblem]{EC}
\end{center}
\end{document}
-
Very nice, I had to update everything on MikTeX to be able to use it as the package is very new! Although I have to add, that for some flags using an aspect ratio where the horizontal length is smaller than the vertical width results into an odd output. An example of what I mean can be seen when using
\worldflag[length=1cm, width=2cm]{US}
.– owmalApr 24, 2021 at 18:14 -
1@owmal Unfortunately, I'm not the package author, you should write to him to report the bug.– CarLaTeXApr 24, 2021 at 18:37
-
There is a PSTricks based package pst-flags
Download the zip files from GitHub project page and put it in your tex file path, see package documentation
Usage: \flagTwoLetterCountryCode[width].
\documentclass{article}
\usepackage{pst-flags}
\begin{document}
Flag of US: \rput(0,0){\flagUS[2]}
\end{document}