44

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.

doncherry
  • 54,637
Peter Smit
  • 14,035
  • 2
    Not that I know of, but you could take an SVG rendering (say, from here: http://www.bastisoft.de/misc/flags/) and convert it to TikZ. – Andrew Stacey May 18 '11 at 12:06
  • @Andrew Stacey: Great idea and link, thanks! On a sidenote, sadly Brazil is not in that flag list. =P – Paulo Cereda May 18 '11 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 Stacey May 18 '11 at 12:39
  • 7
    @Andrew: Wikimedia has Denmark and Brazil: http://commons.wikimedia.org/wiki/Category:SVG_sovereign_state_flags – Jake May 18 '11 at 12:45
  • @Jake: I bow to your superior searching skills. I got the following page from Wikipedia when I searched: http://en.wikipedia.org/wiki/Category:SVG_flags – Andrew Stacey May 18 '11 at 12:47
  • @Jake: I'm with @Andrew, you have some sort of Jedi searching skills. =) – Paulo Cereda May 18 '11 at 13:27
  • @PauloCereda, I'm trying to draw our flag here: https://tex.stackexchange.com/a/438149/14757 – Sigur Jun 27 '18 at 02:48

4 Answers4

36

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.

Brazil Vanuatu Belarus flags

Alan Munn
  • 218,180
  • 16
    That is weird – Seamus May 18 '11 at 16:26
  • 1
    Note: 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. – Speravir Nov 06 '12 at 03:20
  • 5 interesting flags: Poland, Indonesia, Monaco, Austria, and Peru. – kiss my armpit Nov 06 '12 at 04:21
  • @Speravir: I see. Thanks. This comment will be deleted shortly. – kiss my armpit Nov 06 '12 at 04:51
  • Does this still work in 2019? I can't find the flags on my disk (TeX Live @arch) – pasbi May 27 '19 at 12:28
  • 1
    @pasbi No it doesn't. The package was changed in 2015 and all the flags were removed. I've updated the answer. – Alan Munn May 27 '19 at 12:59
  • 1
    @pasbi There is a new package, now. See my answer: https://tex.stackexchange.com/a/594051/101651 – CarLaTeX Apr 22 '21 at 19:52
32

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}

enter image description here

CarLaTeX
  • 62,716
  • 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}. – owmal Apr 24 '21 at 18:14
  • 1
    @owmal Unfortunately, I'm not the package author, you should write to him to report the bug. – CarLaTeX Apr 24 '21 at 18:37
  • Thank you, I have just contacted him. :) – owmal Apr 24 '21 at 21:17
11

bclogo also includes some of them in format .mps.

enter image description here

Ignasi
  • 136,588
  • 3
    The set is quite limited though. The flags included in the answer of @Ignasi (6 November 2012) are the only ones currently included (checked on 19 January 2016). – O0123 Jan 19 '17 at 11:08
6

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}
ami
  • 61