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.

Could you please give some directions how to create the following figure in latex? It is the situation of describing a two parties protocol centered in a box. It is like a 3X4 table but i have difficulties with the alignment. Tikz is the only way for drawing this? figure 3

share|improve this question
1  
See: Trying to put a box around a collection of subfigures The basic command is \fbox. –  Marco Daniel May 21 '12 at 16:59
3  
In my opinion your question is really bad. Why don't you upload some images to demonstrate your request? In the moment I only see links where the helper must scroll. –  Marco Daniel May 21 '12 at 17:32
    
Yes, and if you have to add PDF links please in the form [<title>](<url>) which is much more readable. –  Martin Scharrer May 21 '12 at 17:58
2  
It would be nice if you would add an example image. Please make sure that all images are uploaded using the official stackexchange interface, i.e. the image icon on top of the text field (shortcut: CTRL+G). This ensures that all images are always accessible and do not expire. As new user without image posting privileges simply include the image as normal and remove the ! in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the ! to turn it into an image again. –  Martin Scharrer May 21 '12 at 18:07
add comment

1 Answer

A simple way to add new float or caption types ("Scheme" in this case) is the newfloat package which is part of the caption bundle. There is also the float package which also provides the H (for: place really Here!). The box can be produced by using \fbox{\begin{minipage}{<width>}..\end{minipage}} or, more simpler, using the adjustbox package.

The actual content seems to be best made using a tabular, if you want the same format as in the PDFs.

\documentclass{article}

\usepackage{float}
\usepackage{newfloat}
\DeclareFloatingEnvironment[
    fileext=los,
    listname=List of Schemes,
    name=Scheme,
    placement=H,
    within=section,
]{scheme}

\usepackage{adjustbox}
\usepackage{blindtext}
\begin{document}

\section{Test}
\blindtext

\begin{scheme}
\begin{adjustbox}{minipage=.6\linewidth,fbox,center}
\begin{tabular}{rl}
  \bfseries Encryption:  & .... \\
                         & .... \\
  \bfseries Deccryption: & .... \\
                         & .... \\
            something    & .... \\
                         & .... \\
\end{tabular}
\end{adjustbox}
\caption{Some scheme}
\end{scheme}

\blindtext

\end{document}

Result


Or, using adjustbox v0.9 from 2012/05/16 (available on CTAN and on Bitbucket.org):

\documentclass{article}

\usepackage{newfloat}
\DeclareFloatingEnvironment[
    fileext=los,
    listname=List of Schemes,
    name=Scheme,
    within=section,
]{scheme}

\usepackage{adjustbox}[2012/05/16]
\usepackage{blindtext}
\begin{document}
\listofschemes

\section{Test}
\blindtext

\begin{adjustbox}{tabular={rp{.4\linewidth}},fbox,center,caption={Some scheme},nofloat=scheme}
  \bfseries Encryption:  & .... \\
                         & .... \\
  \bfseries Deccryption: & .... \\
                         & .... \\
            something    & .... \\
                         & .... \\
\end{adjustbox}

\blindtext

\end{document}

Change the nofloat to float if you want the scheme to float. You can of course create a new environment for this if you need it more often.

\newenvironment{xscheme}{\adjustbox{tabular={rp{.4\linewidth}},fbox,center,caption={Some scheme},nofloat=scheme}\bgroup}{\egroup}

Don't call it scheme because that environment is used internally.

share|improve this answer
    
How can i install the newfloat package? i am working on kile. –  curious May 21 '12 at 21:49
2  
@curious: Kile is just the frontend/editor. Can I assume you are using Ubuntu? Maybe with the standard Ubuntu TeX Live 2009 installation? In this case you should install TeX Live 2011 manually: How to install “vanilla” TeXLive on Debian or Ubuntu? or see How do I update my TeX distribution? –  Martin Scharrer May 22 '12 at 6:18
    
I successfully installed tex live 2011 from here running the install-tl script. I then exported the path using export PATH=/usr/local/texlive/2011/bin/x86_64-linux:$PATH i re-opened kile but i am getting the same error: ! LaTeX Error: File `newfloat.sty' not found. when i run pdflatex. How am i sure the kile is compliant with the new installed packages? –  curious May 22 '12 at 11:14
    
@curious: Kile is just the editor, it isn't affected by the (not) installed packages. Check if you installed the package: tlmgr install newfloat or maybe tlmgr install caption. Also make sure that the right pdflatex is used. Maybe Kile is configured to use absolute paths? –  Martin Scharrer May 22 '12 at 12:03
1  
TeX Live 2011 is currently frozen because of the upcoming 2012 release. However, newfloat is part of it and should be still installable. Just ignore the message. Check if newfloat.sty is under /usr/local/texlive/2011, e.g. use find /usr/local/texlive/2011 -name newfloat.sty. If it is there and it still doesn't work then Kile is still using the wrong PATH. Try setting it in a command line window and start Kile from the same window afterwards. –  Martin Scharrer May 22 '12 at 12:48
show 2 more comments

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.