Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I create a drawing like this:

enter image description here

The stuff in red are only explications (with "middle" I meant middle of the drawing representing the spiral) and should not be drawn. Tikz would be best, since I know a tiny little amount of it (which is more than other programs - of which I know nothing) and want to replace the spirals with some of my own decorations.

The text may seem large here, but actually I plan to use the standard font.

Here is a minimal working example (stripped with the LaTeX preambel, since I use LyX):

\begin{tikzpicture} 

\node[align=center]{text text text text \\ text text text text};
% To do: Place a picture here, whose middle is at equal distance between the top line of text and the bottom line and that has a "good-looking" distance from the text
% To do: Place the same picture with same distance requirements here; would be nice if it were mirrored, so I don't have to mirror it externally in a different program.
\end{tikzpicture} 

EDIT (since this was too big for a comment): Ok, modifying answer gives like this

\documentclass{article}
\usepackage{graphicx}

\newlength\decorwidth
\setlength\decorwidth{1cm}

\newcommand\TextDecor[2]{%
  \par\smallskip\noindent%
  \parbox[c]{\decorwidth}{\includegraphics[width=.5\decorwidth]{#1}\hfill}%
  \parbox[c]{\dimexpr\textwidth-2\decorwidth\relax}{#2}%
  \parbox[c]{\decorwidth}{\hfill\includegraphics[width=.5\decorwidth]{#1}}\par\smallskip%
}

\begin{document}


\TextDecor{ornament1}{ \begin{center}text  text text  text\\ text text text  text\end{center}}

\end{document}

it now looks like this. In red is explained on thing I didn't manage to do:

enter image description here

share|improve this question
    
Here is the spiral: tex.stackexchange.com/questions/29147/spiral-spring-in-tikz but the rest is up to you since I don't quite get what is drawn and what is typed. Please add a minimal working example (MWE) that illustrates your problem. –  percusse Aug 24 '12 at 10:07
    
@percusse Well I can't add one, since my knowledge of Tikz is too little to add the spirals (and in particular put them at the correct height). I created this picture in some other drawing program. Th only typed stuff is "text text..." as in \node[align=center]{text text text text \\ text text text text};. The problem is the placement of the spirals left and right of the text. BTW,I just used spirals as a placeholder for some other decorations I have as png's that I plan to use. –  user10324 Aug 24 '12 at 10:30
1  
I don't want to force don't get me wrong but as you can see in your comment you have provided more details that's missing from your question. The reaons of a MWE is not to solve the problem by yourself but lay down the basic structure. We can fill in for you but noone wants to see that the question is changed drastically after working on it some time. That's why we insist on mwes. The node you have given is perfectly fine and can be put in a mwe from \documentclass to \end{document}. and you can put comments in it text here rotated 90 deg etc. –  percusse Aug 24 '12 at 10:38
    
@percusse Ok, I did what I could and edited the question to add a MWE (which is not much more than I wrote in my comment anyway). I hope I conviced everybody, that this question won't change. –  user10324 Aug 24 '12 at 10:54
    
Is the text used always the same or can it change? –  Gonzalo Medina Aug 24 '12 at 17:34
show 1 more comment

2 Answers

up vote 10 down vote accepted

Here's one possibility; I defined a newcommand \TextDecor with two mandatory arguments: the name of the file containing the decoration and the text to be decorated, and one optional argument controlling the separation between the decoration and the text (th deafult value is 10pt). The decorations are included using \includegraphics from the graphicx package.

The idea is to use three \parboxes with centered vertical alignment: two for the decorations and the middle one for the text; the width of the boxes containing the decorations is controlled by the length decorwidth (initially set to be 2cm); of course, you can change the definition of \TextDecor according to your needs:

\documentclass{article}
\usepackage{graphicx}

\newlength\decorwidth
\setlength\decorwidth{1.5cm}
\newlength\decorsep

\newcommand\TextDecor[3][10pt]{%
  \setlength\decorsep{#1}
  \par\smallskip\noindent%
  \parbox[c]{\decorwidth}{\includegraphics[width=\decorwidth]{#2}\hfill}%
  \hspace{\decorsep}%
  \parbox[c]{\dimexpr\textwidth-2\decorwidth-2\decorsep\relax}{#3}%
  \hspace{\decorsep}%
  \parbox[c]{\decorwidth}{\hfill\includegraphics[width=\decorwidth]{#2}}\par\smallskip%
}

\newcommand\Text{% some filler text for the example
Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi
auctor lorem non justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et,
tellus. Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna,
vitae ornare odio metus a mi. Morbi ac orci et nisl hendrerit mollis.
}

\begin{document}

\Text
\TextDecor{ornament1}{\Text}
\Text
\TextDecor[30pt]{ornament2}{\Text}
\Text
\TextDecor[2pt]{ornament3}{\Text}
\Text

\end{document}

enter image description here

share|improve this answer
    
I haven't got the time yet to look properly at your answer. In a couple of hours time I will respond. –  user10324 Aug 24 '12 at 19:49
    
Ok, checked it out. Its almost perfect! But I didn't manage to find out how to set the horizontal distance between the ornaments and the text. In the edit to my question I explained this in a more detailed way. –  user10324 Aug 25 '12 at 10:07
    
@user10324 I've updated my answer; now you can control the separation using an optional argument. –  Gonzalo Medina Aug 25 '12 at 13:48
add comment

Here a suggestion using the package mdframed. To illustrate the ornaments I used the package pifont.

The relevant part are commented in the code. Other settings are documented in the manual.

Instead of using a font or picture you can also work with TikZ which is loaded by the the package mdframed.

\documentclass{article}
\usepackage{graphicx}
\usepackage[framemethod=tikz]{mdframed}
\usetikzlibrary{calc}

\usepackage{pifont}
\usepackage{kantlipsum}

\mdfdefinestyle{ornament}{%
  topline=false,bottomline=false,
 middlelinewidth=2cm, %width of the ornament
 middlelinecolor=white,
 innerleftmargin=.1cm,innerrightmargin=.1cm, %inner distance from ornament
 nobreak,
 singleextra={\path let \p1=(O), \p2=(P) in (\x1,.5*\y2) coordinate (Q);
                           \node at (Q) {\ornamentsetupI};
                           \node at (P|-Q) {\ornamentsetupI};}
}
\newcommand*\ornamentsetup[1]{\def\ornamentsetupI{#1}}


\newmdenv[style=ornament]{ornament}
\ornamentsetup{{\huge\ding{107}}}

\begin{document}

\begin{ornament}
\kant[1]\kant[1]\kant[1]
\kant[1]\kant[1]\kant[1]
\kant[1]\kant[1]\kant[1]
\end{ornament}


\end{document}

enter image description here

share|improve this answer
    
Unfortunately I don't have mdframed, as I'm getting an error while compiling and I can't figure it out how to install it, since it didn't came using my distribution (I'm using Ubuntu and Texmaker) –  user10324 Aug 25 '12 at 12:35
    
mdframed is part of TeXLIve 2012. You should install the newest version of TeXLive instead of handling with the old obsolete version of Ubuntu. –  Marco Daniel Aug 25 '12 at 13:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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