Graphics, Figures & Tablesmultiple figures surrounded with freely floating text

Information and discussion about graphics, figures & tables in LaTeX documents.
User avatar
tommytex
Posts: 39
Joined: Wed Jan 23, 2013 10:04 pm

multiple figures surrounded with freely floating text

Post by tommytex »

ah, and one more thing!
use

Code: Select all

\begin{minipage}[ht]{0.4\textwidth}
\rule{5cm}{22cm}\\\caption{\normalsize some caption1}
\end{minipage}
instead of

Code: Select all

\begin{minipage}[ht]{0.3\textwidth}
\rule{5cm}{22cm}\\\caption{\normalsize some caption1}
\end{minipage}
if you want the figures to be more centered ;)

greez tommytex

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

igor_igel
Posts: 7
Joined: Sun Mar 31, 2013 5:41 pm

Re: multiple figures surrounded with freely floating text

Post by igor_igel »

Thank you again!
Sorry but I am still complaining ;) If I change the text amount of the second lipsum in the code, the formatting gets lost somehow and the original springer style is looking very different from the new geometry. I tried some more things and will summarize them later, but still the problem is giving me headaches.
If you have any ideas in the meantime, I highly appreciate your help.
User avatar
tommytex
Posts: 39
Joined: Wed Jan 23, 2013 10:04 pm

multiple figures surrounded with freely floating text

Post by tommytex »

hi :)

i think i got what you mean....
if i write only 1 sentence on the third page, the text will be centered vertically.
As it is only two pages i would do a little trick:

Code: Select all

\vspace{-....cm}
to adjust the text a bit...

If you've got enough text just split the text up into pieces of equal length! Then the style will be o.k.
Actually, what came to my mind was the package sidecap. See http://commons.wikimedia.org/wiki/File: ... idecap.png

maybe this works, too in this case.
User avatar
tommytex
Posts: 39
Joined: Wed Jan 23, 2013 10:04 pm

multiple figures surrounded with freely floating text

Post by tommytex »

Code: Select all

 \documentclass[smallextended]{svjour3}
\usepackage[english]{babel}
\usepackage{wrapfig}
\usepackage{lipsum}
\usepackage{amsmath}

\usepackage{geometry}
\usepackage{marginnote}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[ER]{}
\fancyhead[OL]{}
\fancyhead[EL]{\thepage}%even left
\fancyhead[OR]{\thepage}%odd right



\begin{document}
This is the text of the previous section,
\lipsum[3]


\section*{Results}

Thats the text that should start with the results section with full page with, float besides the figures and continue on full page width after the figures are shown,\lipsum[40-43]

\newgeometry{top=3cm, bottom=3cm,inner=3.8cm, outer=2.5cm, heightrounded, marginparwidth=5cm, marginparsep=-3cm}
\newpage

\begin{figure}[h]
\begin{minipage}[t]{0.5\textwidth}
\vspace{-11.5cm}
\normalsize\lipsum[40-43]
\end{minipage}
\hfill
\begin{minipage}[h]{0.4\textwidth}
\rule{5cm}{22cm}\\\caption{\normalsize some caption1}
\end{minipage}
\end{figure}

\restoregeometry

\begin{figure}[h]
\begin{minipage}[t]{0.5\textwidth}
\vspace{-11.5cm}
\normalsize The second lipsum is a bit shorter...\lipsum[1]
\end{minipage}
\hfill
\begin{minipage}[h]{0.4\textwidth}
\rule{5cm}{22cm}\\\caption{\normalsize some caption1}
\end{minipage}
\end{figure}

\newgeometry{top=3cm, bottom=3cm,inner=3.8cm, outer=2.5cm, heightrounded, marginparwidth=0cm, marginparsep=0cm}
\lipsum[50-52]

\end{document}
Attachments
TwoColumn3.pdf
(46.82 KiB) Downloaded 364 times
igor_igel
Posts: 7
Joined: Sun Mar 31, 2013 5:41 pm

Re: multiple figures surrounded with freely floating text

Post by igor_igel »

Thank you again! The thing is that we really need a flexible format that works for any text, without splitting at the right points. Not only that it's easier to maintain but most severe after handing in the article there still is the publisher's editor who him self makes changes in the text and I don't think they will understand too much how to handle such constructs :|
Now I looked at so many packages, e.g. picinpar, picins, paracol, also as you sugested sidecaption and marginnote, of course wrapfig, wrapfigure... but still no solution to handle multiple graphics on different pages with a single text floating besides them. Is it possible? There just has to be a solution somewhere out there?!
User avatar
tommytex
Posts: 39
Joined: Wed Jan 23, 2013 10:04 pm

multiple figures surrounded with freely floating text

Post by tommytex »

ok igor....
this is not so easy :mrgreen: :mrgreen:
today i had some time to think about this problem....and i came to a solution!
Unfortunately, the solution is not as simple as the last tex codes :D BUT i have found a way to write one large text which is split up into two parts that show up on the two pages where you can see the two figures. I think adjusting the macro i wrote so that it works for the pages before and after the "figures" section will be not that difficult. The text would wrap around all the four pages then instead of page 2 and 3. So far so good....what i actually did was writing the text into a second .tex file which is only half a pagewidth. This file is compiled by pdflatex (which is a crucial step :evil: because you will need to run your compiler with the option -shell-escape). The generated pdf is only a small strip that can be included using

Code: Select all

\includegraphics
. So you might ask yourself why i was doing all this stuff. The thing is when latex runs over the second .tex file, the figures are missing and the pagebreak is correctly inserted. :roll:
The only thing we have to do now is using the page option

Code: Select all

\includegraphics[page=...]{theseondpdfgeneratedbythemacro}
to place the first page of the generated file on the left side of the second page of our original document and the second page of the generated file on the left hand side of the third page of the original document. :geek:
All this only works with the -shell-escape option enabled! At this point i have to warn you: people who use the write18 command could not only use the command line to execute pdflatex but any other program they'd like to! Do not compile any document if you do not understand what it written in there...(imagine some guy writing some bad code into a batch file and then let the computer execute this...uaaaa :? )
However, you can trust me, i do not intend doing such evil things! ;)

Code: Select all

 \documentclass[smallextended]{svjour3}
\usepackage[english]{babel}
\usepackage{wrapfig}
\usepackage{lipsum}
\usepackage{amsmath}
\usepackage{verbatim}

\usepackage{geometry}
\usepackage{marginnote}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[ER]{}
\fancyhead[OL]{}
\fancyhead[EL]{\thepage}%even left
\fancyhead[OR]{\thepage}%odd right

\usepackage{ifpdf}
\usepackage{graphicx}

\makeatletter

\newcounter{tc@count}
\setcounter{tc@count}{1}


\newwrite\tc@file


\newcommand{\twocolumnfiguretext}{%
	\def\tc@fname{\jobname-twocoltext}%
	\immediate\openout\tc@file=\tc@fname.tex
	\bgroup\let\do\@makeother\dospecials
	\catcode`\^^M\active
	\def\verbatim@processline{%
		\immediate\write\tc@file{\the\verbatim@line}}%
	\immediate\write\tc@file{\unexpanded{\documentclass{svjour3}}}%
	\immediate\write\tc@file{\unexpanded{\usepackage{lipsum}}}%
		\immediate\write\tc@file{\unexpanded{
		\usepackage[paperwidth=80mm,	paperheight=11in,left=0pt,right=0.5cm,top=0pt,bottom=3cm]{geometry}}}%
\immediate\write\tc@file{\unexpanded{\pagestyle{empty}}}%	
\immediate\write\tc@file{\unexpanded{\thispagestyle{empty}}}%
\immediate\write\tc@file{\unexpanded{\setlength{\evensidemargin}{-2.5cm}}}%
\immediate\write\tc@file{\unexpanded{\setlength{\oddsidemargin}{-2.5cm}}}%
\immediate\write\tc@file{\unexpanded{\begin{document}}}%		
	\verbatim@start
}
\def\endtwocolumnfiguretext{%
\immediate\write\tc@file{\unexpanded{\end{document}}}%
\immediate\closeout\tc@file\relax
\immediate\write18{pdflatex \tc@fname.tex}%
\egroup
\includegraphics[scale=1.0,page=\thetc@count]{\tc@fname.pdf}%
\stepcounter{tc@count}%
}
\makeatother


\begin{document}
This is the text of the previous section,
\lipsum[3]


\section*{Results}

Thats the text that should start with the results section with full page with, float besides the figures and continue on full page width after the figures are shown,\lipsum[40-43]

\newgeometry{top=3cm, bottom=3cm,inner=3.8cm, outer=2.5cm, heightrounded, marginparwidth=5cm, marginparsep=-3cm}
\newpage

\begin{figure}[h]
\begin{minipage}[t]{0.5\textwidth}
\vspace{-11.5cm}
\begin{twocolumnfiguretext}
%this is the beginning
\end{twocolumnfiguretext}
\end{minipage}
\hfill
\begin{minipage}[h]{0.4\textwidth}
\rule{5cm}{22cm}\\\caption{\normalsize some caption1}
\end{minipage}
\end{figure}

\restoregeometry

\begin{figure}[h]
\begin{minipage}[t]{0.5\textwidth}
\vspace{-11.5cm}
\begin{twocolumnfiguretext}

\section{Explanation of Figure 1} this is the text i want to be shown next to fig. 1. Because it is very long it is continued on page 3. Here's some nice Formula 
\begin{equation}
t-t_{0}=\sqrt{\frac{l}{g}}\int_{0}^{\varphi}{\frac{d\psi}{\sqrt{1-k^{2}\sin^{2} {\psi}}}} = \sqrt{\frac{l}{g}} F(k,\varphi)
\end{equation} 
\lipsum[40-44]
\section{Explanation of Figure 2} this is the text i want to be shown next fig. 2 \lipsum[45]


\end{twocolumnfiguretext}
\end{minipage}
\hfill
\begin{minipage}[h]{0.4\textwidth}
\rule{5cm}{22cm}\\\caption{\normalsize some caption1}
\end{minipage}
\end{figure}

\newgeometry{top=3cm, bottom=3cm,inner=3.8cm, outer=2.5cm, heightrounded, marginparwidth=0cm, marginparsep=0cm}
\lipsum[50-52]


\end{document}
greez tommy
Attachments
Twocolumn4.pdf
(120.59 KiB) Downloaded 377 times
igor_igel
Posts: 7
Joined: Sun Mar 31, 2013 5:41 pm

Re: multiple figures surrounded with freely floating text

Post by igor_igel »

that looks great :D Right now I don't use pdflatex but when the -shell-escape option is accepted by the editor it will be no big deal to convert the graphics and the formatting is perfect. If you have time you should code a package and I am sure many people would love it :)
Thank you so much!

ps
It might take some time until the questions with the editor are answered. As I told you I hope that -shell-escape will be ok, and I will need to convert my pstricks codes to pdflatex compatible formats.
So if you still need a mission feel welcome to think about a solution with "dvi"latex ;)
Post Reply