8

is it possible to wrap a text inside a triangle like the following image?

enter image description here

  • Does the following help? How to fully center a \Shapepar? – Johannes_B May 19 '16 at 8:35
  • Almost yes. But I don't want my text to have a form of a triangle, but rather to be inside a triangle – Yorgos May 19 '16 at 8:40
  • 1
    just use \begin{center}...\end{center} and then line break by hand using \\ with shorter lines at the top..... – David Carlisle May 19 '16 at 8:49
  • What's the difference between fitting inside a triangle and forming a (slightly smaller) triangle? – sheß May 19 '16 at 9:25
  • the difference is that i want triangles' lines also to be shown. The above suggestions imply once i format my text, then to print my document and after that to draw a triangle by hand. I want to avoid such solution. – Yorgos May 19 '16 at 10:24
14

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:

enter image description here

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

enter image description here

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}

Which gives you enter image description here

  • 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 – Yorgos May 19 '16 at 10:19
  • It is not fully clear to me what you want. You can combine the above code with all kinds of tikzery. – sheß May 19 '16 at 12:03
  • 2
    Maybe my edit helps. – sheß May 19 '16 at 12:15
  • Yes!!!! That was exactly what I wanted! – Yorgos May 19 '16 at 12:44
11

Quick demonstration with TikZ:

enter image description here

\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}
3

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} 

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.