4

The text in the node in left-aligned. How can I make it justified?

\documentclass[20pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{paperheight=50cm,paperwidth=50cm,margin=3mm}
\usepackage{tikz, pgfornament, tikzrput}
\usetikzlibrary{shapes,positioning,decorations.markings}
\usepackage{bookman}
\PassOptionsToPackage{dvipsnames,svgnames}{xcolor} 
\usepackage{pdfrender}
\usepackage{pdfpages}
\makeatletter
\DeclareRobustCommand{\regmark}{\raisebox{1.13ex}{%
\fontsize{.4\dimexpr\f@size pt}\z@\selectfont\textregistered}%
 }
 \makeatother
\begin{document}
\centering
{
\begin{tikzpicture}
\begin{scope}[color=black,
                every node/.style={inner sep=0pt}]
\node[minimum size=12cm](vecbox){}; 
 \node[anchor=north west, yshift=10cm, xshift=-18.2cm] at (vecbox.north west)
  {\pgfornament[width=5cm]{61}};
  \node[anchor=north east, yshift=10cm, xshift=18.5cm] at (vecbox.north east)
  {\pgfornament[width=5cm,symmetry=v]{61}};
  \node[anchor=south west, yshift=-27cm, xshift=-18.2cm] at (vecbox.south west)
  {\pgfornament[width=5cm, symmetry=h]{61}};
  \node[anchor=south east, yshift=-27cm, xshift=18.5cm] at (vecbox.south east)
  {\pgfornament[width=5cm,symmetry=c]{61}};
  \end{scope}
  \node (example-textwidth-2) [text width=42cm, font=\fontsize{40pt}{40pt}  \selectfont] at (0.4,-7) {%
  {\textbf{INGREDIENTS:} WATER, SODIUM LAURETH SULFATE, SODIUM LAURYL SULFATE, COCAMIDOPROPYL BETANE, SODIUM CHLORIDE, DECYL GLUCOSIDE, FRAGRANCE, DMDM HYDANTION, PEG-120 METHYLGLUCOSE DIOLEATE, COCAMIDE MEA, POLYQUARTERNIUM-7 TETRASODIUM EDTA, PEG-7 GLYCERYL COCATE, CITRIC ACID, DC RED NO.33, FDC BLUE}
 };
 \draw [line width=3mm,   black] (-14,-14) -- (14,-14) node [right] {};
 \draw [line width=3mm,   black] (-14,0) -- (14,0) node [right] {};
 \begin{scope}
  \newcommand{\CloudDist}{1.8}
   \tikzstyle {cloudkeys} = [cloud puffs=15, cloud puff arc=150, aspect=4, inner sep=.01cm] 
   \tikzstyle {mycloud}   = [draw, cloud, cloudkeys, fill=white, opaque, xshift=0cm, yshift=10cm] 
    \coordinate (cloud 0);
    \foreach \x in {0} {
   \node [mycloud, scale=1] at (cloud \x) (local map cloud shape \x){\textcolor{black}{\Huge\textbf{The Miracle}}};
    }
   \end{scope}
   \end{tikzpicture}
    }
    \end{document}

justify

2
  • 2
    What precisely do you mean by "justified"? TikZ has a key align=justify, did you try that? – user121799 Nov 13 '18 at 15:02
  • Thank you very much. That is what I was looking for. @marmot – Reza Nov 13 '18 at 15:08
3

I'll be happy to remove this. In addition to align=justify you may want to remove the spaces in font=\fontsize{40pt}{40pt} \selectfont and replace \tikzstyle by the corresponding \tikzset construction.

\documentclass[20pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{paperheight=50cm,paperwidth=50cm,margin=3mm}
\usepackage{tikz, pgfornament, tikzrput}
\usetikzlibrary{shapes,positioning,decorations.markings}
\usepackage{bookman}
\PassOptionsToPackage{dvipsnames,svgnames}{xcolor} 
\usepackage{pdfrender}
\usepackage{pdfpages}
\makeatletter
\DeclareRobustCommand{\regmark}{\raisebox{1.13ex}{%
\fontsize{.4\dimexpr\f@size pt}\z@\selectfont\textregistered}%
 }
 \makeatother
\begin{document}
\centering
{
\begin{tikzpicture}
\begin{scope}[color=black,
                every node/.style={inner sep=0pt}]
\node[minimum size=12cm](vecbox){}; 
 \node[anchor=north west, yshift=10cm, xshift=-18.2cm] at (vecbox.north west)
  {\pgfornament[width=5cm]{61}};
  \node[anchor=north east, yshift=10cm, xshift=18.5cm] at (vecbox.north east)
  {\pgfornament[width=5cm,symmetry=v]{61}};
  \node[anchor=south west, yshift=-27cm, xshift=-18.2cm] at (vecbox.south west)
  {\pgfornament[width=5cm, symmetry=h]{61}};
  \node[anchor=south east, yshift=-27cm, xshift=18.5cm] at (vecbox.south east)
  {\pgfornament[width=5cm,symmetry=c]{61}};
  \end{scope}
  \node (example-textwidth-2) [text width=42cm, font=\fontsize{40pt}{40pt}\selectfont,
  align=justify] at (0.4,-7) {%
  \textbf{INGREDIENTS:} WATER, SODIUM LAURETH SULFATE, SODIUM LAURYL SULFATE, COCAMIDOPROPYL BETANE, SODIUM CHLORIDE, DECYL GLUCOSIDE, FRAGRANCE, DMDM HYDANTION, PEG-120 METHYLGLUCOSE DIOLEATE, COCAMIDE MEA, POLYQUARTERNIUM-7 TETRASODIUM EDTA, PEG-7 GLYCERYL COCATE, CITRIC ACID, DC RED NO.33, FDC BLUE
 };
 \draw [line width=3mm,   black] (-14,-14) -- (14,-14) node [right] {};
 \draw [line width=3mm,   black] (-14,0) -- (14,0) node [right] {};
 \begin{scope}
  \newcommand{\CloudDist}{1.8}
   \tikzset{cloudkeys/.style={cloud puffs=15, cloud puff arc=150, aspect=4,
   inner sep=.01cm},
   mycloud/.style={draw, cloud, cloudkeys, fill=white, opaque, xshift=0cm,
   yshift=10cm}}
    \coordinate (cloud 0);
    \foreach \x in {0} {
   \node [mycloud, scale=1] at (cloud \x) (local map cloud shape \x){\textcolor{black}{\Huge\textbf{The Miracle}}};
    }
 \end{scope}
\end{tikzpicture}
}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.