# Box environment created with frame box

I am creating the box environment using packages environ and float.

But I will try to put the \BODY part after the caption and also try to fix the "framebox environment" by using \fbox{} command.

But I can't fix my above two requirements.

MWE

  \documentclass[twocolumn]{article}
\usepackage{graphics}%
\usepackage{epstopdf}%
\usepackage{graphicx,environ}
\usepackage{hyperref}
%\usepackage{float}
%\newfloat{Box}{htbp}{lob}% float package usage
\usepackage{floatrow}

\usepackage[%showframe,%
a4paper,%
paperwidth=8.27in,%
paperheight=10.83in,%
textwidth=7.018in,%
textheight=9.08in,%
twocolumn,%
columnsep=13.7pt,%
top=2.06cm,%
bottom=2.35cm,%
left=45.28pt,%
right=45.28pt,%
headheight=10.63pt,%
headsep=26.25pt,%
footskip=21pt,%
]{geometry}

\makeatletter
\DeclareNewFloatType{Box}{
placement=htbp,
fileext=lob}
\floatsetup[Box]{
style=BOXED,
capposition=top,
justification=justified}

\newcommand{\processdblfigure}[2]{\centering\fbox{\parbox{173.5mm}{\rightskip12\p@\centering#1\vspace*{-3.5\p@}\par\rightskip12\p@%
\begin{multicols}{2}\caption{#2}
\end{multicols}\vspace*{-12\p@}}}}

\newcommand{\processfigure}[2]{\centering\fbox{\parbox{82mm}{\rightskip12\p@\centering#1\vspace*{-3.5\p@}\par\rightskip12\p@%
\caption{#2}}}}

\newcommand{\singledblfigure}[2]{\centering\fbox{\parbox{173.5mm}{\rightskip12\p@\centering#1\vspace*{-3.5\p@}\par\rightskip12\p@%
\caption{#2}}}}

\newenvironment{BOX}[2][htbp]{%
\begin{Box}[#1]
\ifx\relax#2\relax\else\caption{#2}\fi
}{\end{Box}}

\newenvironment{BOX*}[2][htbp]{%
\begin{Box*}[#1]
\ifx\relax#2\relax\else\caption{#2}\fi
}{\end{Box*}}

\makeatother

\begin{document}

Among the various hydrocarbon polymers, polyether ether ketone (PEEK) based membranes are well known  due to their good thermal stability, appropriate mechanical strength, and when sulfonated, good proton conductivity, which increases with the degree of sulfonation (DS). However, these aromatic polymer electrolytes with high IEC, which show high proton conductivity, have the problem of weak mechanical behavior due to some water solubility, and this is one of the main obstacles for application in PEMFCs.

\begin{BOX*}[t]{Textwidth box caption text}
\textbf{Full width box caption} Full width box captionFull width box captionFull width box
captionFull width box captionFull width box captionFull width box captionFull width box
captionFull width box captionFull width box captionFull width box caption
\end{BOX*}

Among the various hydrocarbon polymers, polyether ether ketone (PEEK)
based membranes are well known  due to their good thermal stability, appropriate mechanical strength, and when sulfonated, good proton conductivity, which increases with the degree of sulfonation (DS). However, these aromatic polymer electrolytes with high IEC, which show high proton conductivity, have the problem of weak mechanical behavior due to some water solubility, and this is one of the main obstacles for application in PEMFCs.

\begin{BOX}[b]{Column width caption text}
\textbf{Column width Body caption} Column width Body captionColumn width Body captionColumn
width Body captionColumn width Body captionColumn width Body captionColumn width Body
captionColumn width Body captionColumn width Body captionColumn width Body captionColumn
width Body captionColumn width Body captionColumn width Body captionColumn width Body caption
\end{BOX}

Among the various hydrocarbon polymers, polyether ether ketone (PEEK) based membranes are well known  due to their good thermal stability, appropriate mechanical strength, and when sulfonated, good proton conductivity, which increases with the degree of sulfonation (DS). However, these aromatic polymer electrolytes with high IEC, which show high proton conductivity, have the problem of weak mechanical behavior due to some water solubility, and this is one of the main obstacles for application in PEMFCs.

Among the various hydrocarbon polymers, polyether ether ketone (PEEK) based membranes are well known  due to their good thermal stability, appropriate mechanical strength, and when sulfonated, good proton conductivity, which increases with the degree of sulfonation (DS). However, these aromatic polymer electrolytes with high IEC, which show high proton conductivity, have the problem of weak mechanical behavior due to some water solubility, and this is one of the main obstacles for application in PEMFCs.

Among the various hydrocarbon polymers, polyether ether ketone (PEEK) based membranes are well known  due to their good thermal stability, appropriate mechanical strength, and when sulfonated, good proton conductivity, which increases with the degree of sulfonation (DS). However, these aromatic polymer electrolytes with high IEC, which show high proton conductivity, have the problem of weak mechanical behavior due to some water solubility, and this is one of the main obstacles for application in PEMFCs.

Among the various hydrocarbon polymers, polyether ether ketone (PEEK) based membranes are well known  due to their good thermal stability, appropriate mechanical strength, and when sulfonated, good proton conductivity, which increases with the degree of sulfonation (DS). However, these aromatic polymer electrolytes with high IEC, which show high proton conductivity, have the problem of weak mechanical behavior due to some water solubility, and this is one of the main obstacles for application in PEMFCs.

\begin{figure}[!t]
\processfigure{\centerline{\includegraphics{Sample1.eps}}}
{\textbf{\boldmath WU (\%) after immersion in water at 100 C for 24\,h as a function of DXL for a SPEEK sample with an initial IEC\,$=$\,2.5\,meq/g}. In parenthesis, the time of the second treatment at 180 C is shown.\label{fig:2}}
\end{figure}

Among the various hydrocarbon polymers, polyether ether ketone (PEEK) based membranes are well known  due to their good thermal stability, appropriate mechanical strength, and when sulfonated, good proton conductivity, which increases with the degree of sulfonation (DS). However, these aromatic polymer electrolytes with high IEC, which show high proton conductivity, have the problem of weak mechanical behavior due to some water solubility, and this is one of the main obstacles for application in PEMFCs.

Among the various hydrocarbon polymers, polyether ether ketone (PEEK) based membranes are well known  due to their good thermal stability, appropriate mechanical strength, and when sulfonated, good proton conductivity, which increases with the degree of sulfonation (DS). However, these aromatic polymer electrolytes with high IEC, which show high proton conductivity, have the problem of weak mechanical behavior due to some water solubility, and this is one of the main obstacles for application in PEMFCs.

Among the various hydrocarbon polymers, polyether ether ketone (PEEK) based membranes are well known  due to their good thermal stability, appropriate mechanical strength, and when sulfonated, good proton conductivity, which increases with the degree of sulfonation (DS). However, these aromatic polymer electrolytes with high IEC, which show high proton conductivity, have the problem of weak mechanical behavior due to some water solubility, and this is one of the main obstacles for application in PEMFCs.

Among the various hydrocarbon polymers, polyether ether ketone (PEEK) based membranes are well known  due to their good thermal stability, appropriate mechanical strength, and when sulfonated, good proton conductivity, which increases with the degree of sulfonation (DS). However, these aromatic polymer electrolytes with high IEC, which show high proton conductivity, have the problem of weak mechanical behavior due to some water solubility, and this is one of the main obstacles for application in PEMFCs.

Among the various hydrocarbon polymers, polyether ether ketone (PEEK) based membranes are well known  due to their good thermal stability, appropriate mechanical strength, and when sulfonated, good proton conductivity, which increases with the degree of sulfonation (DS). However, these aromatic polymer electrolytes with high IEC, which show high proton conductivity, have the problem of weak mechanical behavior due to some water solubility, and this is one of the main obstacles for application in PEMFCs.

\begin{figure*}[!t]
\singledblfigure{\centerline{\includegraphics{sample2.eps}}}
{\textbf{\boldmath Cross-link reaction for SPEEK (color code: gray C, yellow S, red O)}.\label{fig:1}}
\end{figure*}

\end{document}


My required output below mentioned

My MWE output and problems below mentioned here:

## 1 Answer

Here's an option using floatrow - an extension of the float package:

\documentclass[twocolumn]{article}
\usepackage[paper=a5paper]{geometry}% Just for this example
\usepackage{graphicx,environ}
%\usepackage{float}
%\newfloat{Box}{htbp}{lob}% float package usage
\usepackage{floatrow}
\DeclareNewFloatType{Box}{
placement=htbp,
fileext=lob}
\floatsetup[Box]{
style=BOXED,
capposition=top,
justification=justified}

\newenvironment{BOX}[2][htbp]{%
\begin{Box}[#1]
\ifx\relax#2\relax\else\caption{\textbf{#2}}\fi
}{\end{Box}}

\newenvironment{BOX*}[2][htbp]{%
\begin{Box*}[#1]
\ifx\relax#2\relax\else\caption{\textbf{#2}}\fi
}{\end{Box*}}

\usepackage{hyperref}

\begin{document}

\begin{BOX*}{Textwidth box caption text}
\textbf{Full width box caption} Full width box captionFull width box captionFull width box
captionFull width box captionFull width box captionFull width box captionFull width box
captionFull width box captionFull width box captionFull width box caption
\end{BOX*}

\begin{BOX}{Column width caption text}
\textbf{Column width Body caption} Column width Body captionColumn width Body captionColumn
width Body captionColumn width Body captionColumn width Body captionColumn width Body
captionColumn width Body captionColumn width Body captionColumn width Body captionColumn
width Body captionColumn width Body captionColumn width Body captionColumn width Body caption
\end{BOX}

\end{document}


Note that mixing single/double-column floats in a twocolumn document could lead to a mix-up in the float placements. It's visible in the above example, where Box 2 is displayed on page 1, while Box 1 is displayed on page 2.

• This above coding environments is affected the normal figure environments. The output only apply the box environments only. How to rectify this problem? Kindly advice. Jan 22, 2015 at 7:32
• @Vetri: Not in my minimal example. Please provide me with the details so I can replicate the problem you're experiencing.
– Werner
Jan 22, 2015 at 7:36
• I edit and save my question. I edit and save my MWE. I mentioned my problems in MWE output. Kindly advice Jan 22, 2015 at 14:38
• @Vetri: I don't understand your English statement regarding the figure. Your original question mentioned that you're after a Box environment, which has been solved. Now you want this to also be done for figures?
– Werner
Jan 22, 2015 at 15:30
• I already fixed the figure environment accurately. While i implemented the your MWE for box environment code, which affected the figure environment. So that the figure environment get disturbed. Jan 22, 2015 at 15:54