is it possible to wrap a text inside a triangle like the following image?
3 Answers
It is always appreciated if you show a bit of compilable code that shows the effort you already put into finding a solution. If you have nothing, maybe put at least a bit like:
\documentclass{article}
\begin{document}
\end{document}
The following might give you some ideas of how you could solve your problem:
shapepar
solution:
As pointed out in the comment shapepar
might be what you need. Though the question that remains is, what do you consider to be different between the text having the form of a triangle and fitting the text inside a triangle.
What could work is:
\documentclass[12pt]{article}
\usepackage{shapepar}
\usepackage[default]{frcursive}
\usepackage{color}
\def\sailshape{%
{0}%
{0}b{0}\\%
{8.66}t{-5}{10}\\%
{17.32}t{-10}{20}\\%
{17.32}e{0}%
}
\def\sailpar#1{\centering\Shapepar\sailshape#1\unskip}
\begin{document}
\sailpar{\large\bfseries\textcolor{blue}{\\Join Graham as he Sets Sail For the ``7'' Seas} \textcolor{red}{Saturday, September 15th, 2:00 - 3:30 pm, Lake Oconee Reynolds Pantation ~ (012) 345 678} \textcolor{blue}{Let us know if you can sail-a-brate with us! Reply to Lydia (098) 765 432 1}}
\end{document}
Which yields:
As you can see, the lines break automatically.
Manual line breaks:
If you start doing it manually --because you want them to break at particular points-- you should go with David's comments and just break them all manually, inside a center
environment:
\documentclass[12pt]{article}
\usepackage[default]{frcursive}
\usepackage{color}
\begin{document}
\begin{center}
\large\bfseries\textcolor{blue}{Join\\Graham\\as he\\Sets Sail\\For the ``7'' Seas}\\\textcolor{red}{Saturday, September 15th,\\2:00 - 3:30 p.m.\\Lake Oconee\\Reynolds Pantation ~ (012) 345 678}\\\textcolor{blue}{Let us know if you can sail-a-brate with us!\\Reply to Lydia (098) 765 432 1}
\end{center}
\end{document}
Which gives you
EDIT: Solution with a background image:
You can combine this with any picture of a triangle you might have, or draw one yourself using tikz:
\documentclass[12pt]{article}
\usepackage{shapepar}
\usepackage{tikz}
\usepackage[default]{frcursive}
\usepackage{color}
\def\sailshape{{0}{0}b{0}\\{8.66}t{-5}{10}\\{17.32}t{-10}{20}\\{17.32}e{0}}
\def\sailpar#1{\centering\Shapepar\sailshape#1\par}
\begin{document}
\begin{tikzpicture}
\node[inner sep=0,anchor=south west] at (0,0) {\includegraphics[width=\textwidth]{Unbenannt.png}};
\node[draw=none,align=center,text width=4cm,anchor=south] at (40mm, 58mm) {\sailpar{\small\bfseries\textcolor{blue}{\\Join Graham as he sets sail For the ``7'' seas} \textcolor{red}{Saturday, September 15th, 2:00 - 3:30 pm, Lake Oconee Reynolds Pantation (012) 345 678} \textcolor{blue}{Let us know if you can sail-a-brate with us! Reply to Lydia (098) 765 432 1}}};
\end{tikzpicture}
\end{document}
-
Thanks, but this solution solves only partially my problem (the alignment). I want to draw a triangle and then to add the text inside it. So, the remaining problem is how to draw the triangle around the aligned text– YorgosMay 19, 2016 at 10:19
-
It is not fully clear to me what you want. You can combine the above code with all kinds of
tikz
ery.– sheßMay 19, 2016 at 12:03 -
2
-
Quick demonstration with TikZ:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\node[
draw,
align=center,
regular polygon,
regular polygon sides=3,
inner sep=-10pt] {
Join \\
Graham \\
as he sets sail\\
\ldots};
\end{tikzpicture}
\end{document}
A simple tabular
and 3 pstricks nodes
. The text is written first, and a triangle is added around it:
\documentclass[x11names]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{ebgaramond}
\usepackage{array}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}
\psset{unit = 2,dotsize = 2.5pt}
\begin{document}
\begin{postscript}
\rlap{\begin{tabular}{@{}>{\color{RoyalBlue4}}c@{}}
\pnode[0,6ex]{A}\\ Join \\ \large Graham \\ as he \\ Sets Sail \\ For the "7" Seas \\\\
\begin{tabular}{@{}>{\color{IndianRed2}}c@{}}
Saturday, September 15 th \\ 2:00-3:30 p.m. \\ Lake Oconee \\ Reynolds Plantation
\end{tabular}\\[6ex]%
\small%
\pnode[-3.5em,-5ex]{B} Let us know if you can sail a-brate with us\pnode[3.5em, -5ex]{C} \\
\small Reply to Lydia
\end{tabular}%}
\pspolygon[linecolor=white, fillstyle = solid, fillcolor=AntiqueWhite2,opacity =0.2](A)(B)(C)}%
\end{postscript}
\end{document}
\begin{center}...\end{center}
and then line break by hand using\\
with shorter lines at the top.....