# How can I create a 'Nutrition Facts' label?

I'd like to make the Nutrition Facts below.

I'm pretty new to LaTeX.

I can modify templates I find on the web, define new commands, redefine commands, but I have no idea what a macro is, all my LaTeX script is always on one page. Even with comments, my LaTeX script is atrociously horrendous to look at, especially with tons of math symbols.

I'm wondering what's the recommended way to create this Nutrition Facts label, being able to change the size (obviously smaller), and being able to put multiple Nutrition Facts label in my document. So maybe it's like some sort of \newcommand? That's what I'm thinking. It seems like the grey lines can be made with \hrule, with different widths. I'm not sure.

What do you guys recommend? Thanks.

-
Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. –  Claudio Fiandrino Jun 11 '13 at 6:55
On a non-TeXy note, the phrasing 'Nutrition Facts' sounds off to me; checking the three labelled food items I have in my room at the moment, they go with either 'Nutrition' or 'Nutrition Information'. –  dbmag9 Jun 11 '13 at 7:04

Here's my take.

I had to wait for a delayed train. ;-)

\documentclass[border=2]{standalone}
\usepackage{xparse}
\usepackage{booktabs}
\newlength{\NFwidth}
\setlength{\NFwidth}{2.5in}

\NewDocumentCommand{\NFelement}{mmm}{\large\textbf{#1} #2\hfill #3}
\NewDocumentCommand{\NFline}{O{l}m}{\makebox[\NFwidth][#1]{#2}}
\NewDocumentCommand{\NFentry}{sm}{%
\makebox[.5\NFwidth][l]{\large
\IfBooleanT{#1}{\makebox[0pt][r]{\textbullet\ }}%
#2}\ignorespaces}
\NewDocumentCommand{\NFtext}{+m}
{\parbox{\NFwidth}{\raggedright#1}}

\newcommand{\NFtitle}{\multicolumn{1}{c}{\Huge\bfseries Nutrition Facts}}

\newcommand{\NFRULE}{\midrule[6pt]}
\newcommand{\NFRule}{\midrule[3pt]}
\newcommand{\NFrule}{\midrule}

\begin{document}
\sffamily
\fbox{%
\begin{tabular}{@{}p{\NFwidth}@{}}
\NFtitle\\
\NFtext{Serving Size 2 tbsp.\ (33\,g)}\\
\NFtext{Servings Per Container 7}\\
\NFRULE
\NFline{Amount Per Serving}\\
\NFrule
\NFelement{Calories}{20}{Calories from Fat 10}\\
\NFRule
\NFline[r]{\% Daily Value*}\\
\NFrule
\NFelement{Total Fat}{1\,g}{2\%}\\
\NFrule
\NFelement{Sodium}{190\,mg}{8\%}\\
\NFrule
\NFelement{Total Carbohydrate}{2\,g}{1\%}\\
\NFrule
\NFelement{Protein}{1\,g}{}\\
\NFRule
\NFentry{Vitamin A 2\%}
\NFentry*{Vitamin C 15\%}\\
\NFentry{Iron 10\%}
\NFentry*{Vitamin B6 20\%}\\
\NFentry{Vitamin B12 4\%}\\
\NFrule
\NFtext{Not a significant source of saturated fat,
trans fat, cholesterol, dietary fiber, sugars,
and calcium.}\\
\NFrule
\NFtext{* Percent Daily Values are based on a
2,000 calorie diet.}
\end{tabular}}
\end{document}


-
Oh my gosh, this is beautiful. Where did you learn to do this? Thanks so much! I actually thought you pulled this from Google Images until I saw the font again (nobody would use that font for a real label). Can't believe you did this in 15 minutes (train wait time?). –  Jason Jun 12 '13 at 8:43
@Jason I was at the station 10 minutes in advance and the delay was 10 minutes. I admit to have worked also some minutes when aboard. ;-) –  egreg Jun 12 '13 at 8:46

One possibility defining some auxiliary commands:

\documentclass{article}
\usepackage{graphicx}

\newcommand\myrule[1][1pt]{%
\par\rule[1ex]{\linewidth}{#1}\par}

\newcommand\titlefont{\normalfont\Huge\bfseries}

\newcommand\Nline[3]{\textbf{#1}~#2\hfill#3\par}

\newcommand\Bullet[1]{\parbox{.5\linewidth}{\makebox[1em][l]{$\bullet$}#1}}

\newcommand\NutFact[3][8cm]{%
\par\noindent\resizebox{!}{#2}{\fbox{\begin{minipage}{#1}
\raggedright\sffamily
\vskip10pt
{\titlefont Nutrition Facts\par\medskip}
\large
#3
\end{minipage}}}%
}

\begin{document}

\NutFact{5cm}{%
Serving Size 2 tbsp. (33g) \par
Servings per Container 7\par
\myrule[9pt]
{\normalfont Amount per Serving\par}
\myrule
\Nline{Calories}{20}{Calories from Fat 10}
\myrule[6pt]
\hfill{\normalfont \% Daily Value\textsuperscript{*}\par}
\myrule
\Nline{Total Fat}{1g}{2\,\%}
\myrule
\Nline{Sodium}{190mg}{8\,\%}
\myrule
\Nline{Total Carbohydrate}{2g}{1\,\%}
\myrule
\Nline{Protein}{1g}{}
\myrule[11pt]
\Bullet{Vitamin A 10\,\%}%
\Bullet{Vitamin C 15\,\%}\par
\myrule
\Bullet{Iron 10\,\%}%
\Bullet{Vitamin B6 20\,\%}\par
\myrule
\Bullet{Vitamin B12 4\,\%}\par
\myrule
Not a significant source of satured fat, trans fat, cholesterol, dietary fiber, sugars, and calcium.
\myrule
\textsuperscript{*} Percent Daily Values are based on a 2,000 calorie diet.
}

\NutFact{4cm}{%
Serving Size 2 tbsp. (33g) \par
Servings per Container 7\par
\myrule[9pt]
{\normalfont Amount per Serving\par}
\myrule
\Nline{Calories}{20}{Calories from Fat 10}
\myrule[6pt]
\hfill{\normalfont \% Daily Value\textsuperscript{*}\par}
\myrule
\Nline{Total Fat}{1g}{2\,\%}
\myrule
\Nline{Sodium}{190mg}{8\,\%}
\myrule
\Nline{Total Carbohydrate}{2g}{1\,\%}
\myrule
\Nline{Protein}{1g}{}
\myrule[11pt]
\Bullet{Vitamin A 10\,\%}%
\Bullet{Vitamin C 15\,\%}\par
\myrule
\Bullet{Iron 10\,\%}%
\Bullet{Vitamin B6 20\,\%}\par
\myrule
\Bullet{Vitamin B12 4\,\%}\par
\myrule
Not a significant source of satured fat, trans fat, cholesterol, dietary fiber, sugars, and calcium.
\myrule
\textsuperscript{*} Percent Daily Values are based on a 2,000 calorie diet.
}

\end{document}


\NutFact has two mandatory arguments: the second one is the nutritional fact information, and the first one allows for some scaling; there's also an optional argument for the width of the inner minipage used.

-

With minipage you can do something.

Many other solution can do the job, e.g. with tabular

\documentclass{article}
\usepackage{siunitx}
\begin{document}

\begin{minipage}[h]{0.5\linewidth}
{\Large \bfseries Nutrition facts}

Serving Size tbsp. (\SI{33}{\gram})

Servings per container 7

\noindent\makebox[\linewidth]{\rule{\linewidth}{3pt}}

Amount per serving

\noindent\makebox[\linewidth]{\rule{\linewidth}{0.5pt}}

\textbf{Calories} \hfill Calories from Fat 10
\noindent\makebox[\linewidth]{\rule{\linewidth}{2pt}}

\flushright \% Daily Value \textsuperscript{*}

\noindent\makebox[\linewidth]{\rule{\linewidth}{0.5pt}}
\flushleft
\textbf{Total Fat} \SI{1}{\gram} \hfill 2\%

\noindent\makebox[\linewidth]{\rule{\linewidth}{0.5pt}}

\textbf{Sodium} \SI{190}{\milli\gram}

\noindent\makebox[\linewidth]{\rule{\linewidth}{3pt}}
\begin{tabbing}