Text FormattingUsing boxedminipage, but how can I put both txt and pict?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Using boxedminipage, but how can I put both txt and pict?

Post by latexforever »

Hello,

I am using the boxedminipage package. Here is a MWE of what I am trying to do.

Code: Select all

\documentclass[10pt]{article}
\usepackage[latin1]{inputenc}
\usepackage{everyshi}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{pstricks}
\usepackage[dvipsnames]{xcolor}
%\usepackage{epsfig}
\usepackage{fancybox}
\usepackage{pst-grad} % For gradients
\usepackage{pst-plot} % For axes
%\usepackage{textcomp} % For degrees
\usepackage{pst-text}
\usepackage{pst-tree}
\usepackage{pst-eps}
\usepackage{pst-fill}
\usepackage{pst-node}
\usepackage{pst-math}
\usepackage{psfrag}
\usepackage{gensymb}
\usepackage{lscape}
\usepackage[usenames,dvipsnames]{pstricks}
\usepackage{amsthm}
\usepackage{lettrine}
\usepackage{color}
\usepackage{rotating}
\usepackage{fancyhdr}
\usepackage{boxedminipage}

\begin{document}
\begin{boxedminipage}{\textwidth}
Il faut déterminer la distance entre les points $C$ et $D$ à partir des données fournies sur la Figure \ref{fig:exempleapplictrigono}.
% Generated with LaTeXDraw 2.0.1
% Sun Apr 26 10:35:27 CEST 2009
% \usepackage[usenames,dvipsnames]{pstricks}
% \usepackage{epsfig}
% \usepackage{pst-grad} % For gradients
% \usepackage{pst-plot} % For axes
\begin{figure}[!h]
\begin{center}
\scalebox{1} % Change this value to rescale the drawing.
{
\begin{pspicture}(0,-4.371406)(9.4775,4.371406)
\psline[linewidth=0.04cm](0.3571875,-3.9470313)(6.9571877,1.9529687)
\psline[linewidth=0.04cm](6.9571877,1.9529687)(3.4771874,3.9929688)
\psline[linewidth=0.04cm](3.4571874,4.0129685)(9.157187,-3.8670313)
\psline[linewidth=0.04cm](9.157187,-3.8670313)(6.9571877,1.9329687)
\psline[linewidth=0.04cm](3.4771874,4.0129685)(0.3771875,-3.9270313)
\psline[linewidth=0.04cm](0.3771875,-3.9270313)(9.157187,-3.8670313)
\usefont{T1}{ptm}{m}{n}
\rput(3.3771875,4.2029686){D}
\usefont{T1}{ptm}{m}{n}
\rput(7.124375,2.1629686){$C$}
\usefont{T1}{ptm}{m}{n}
\rput(0.12375,-3.9970312){$A$}
\usefont{T1}{ptm}{m}{n}
\rput(9.324375,-4.017031){$B$}
\usefont{T1}{ptm}{m}{n}
\rput(4.7696877,-4.2170315){$10$}
\pscustom[linewidth=0.04]
{
\newpath
\moveto(1.3771875,-3.0470312)
\lineto(1.3771875,-3.1070313)
\curveto(1.3771875,-3.1370313)(1.3621875,-3.2170312)(1.3471875,-3.2670312)
\curveto(1.3321875,-3.3170311)(1.3021874,-3.4070313)(1.2871875,-3.4470313)
\curveto(1.2721875,-3.4870312)(1.2421875,-3.5570312)(1.2271875,-3.5870314)
\curveto(1.2121875,-3.6170313)(1.1821876,-3.6820312)(1.1671875,-3.7170312)
\curveto(1.1521875,-3.7520313)(1.1221875,-3.8020313)(1.1071875,-3.8170311)
\curveto(1.0921875,-3.8320312)(1.0621876,-3.8570313)(1.0471874,-3.8670313)
\curveto(1.0321875,-3.8770313)(1.0071875,-3.8920312)(0.9771875,-3.9070313)
}
\usefont{T1}{ptm}{m}{n}
\rput(1.5634375,-3.5170312){$30°$}
\pscustom[linewidth=0.04]
{
\newpath
\moveto(1.1371875,-1.9270313)
\lineto(1.1771874,-1.9470313)
\curveto(1.1971875,-1.9570312)(1.2721875,-2.0070312)(1.3271875,-2.0470312)
\curveto(1.3821875,-2.0870314)(1.4921875,-2.1720312)(1.5471874,-2.2170312)
\curveto(1.6021875,-2.2620313)(1.6871876,-2.3520312)(1.7171875,-2.3970313)
\curveto(1.7471875,-2.4420311)(1.8121876,-2.5420313)(1.8471875,-2.5970314)
\curveto(1.8821875,-2.6520312)(1.9521875,-2.7820313)(1.9871875,-2.8570313)
\curveto(2.0221875,-2.9320312)(2.0671875,-3.0670311)(2.0771875,-3.1270313)
\curveto(2.0871875,-3.1870313)(2.0971875,-3.2870312)(2.0971875,-3.3270311)
\curveto(2.0971875,-3.3670313)(2.0971875,-3.4520311)(2.0971875,-3.4970312)
\curveto(2.0971875,-3.5420313)(2.0971875,-3.6170313)(2.0971875,-3.6470313)
\curveto(2.0971875,-3.6770313)(2.0921874,-3.7320313)(2.0871875,-3.7570312)
\curveto(2.0821874,-3.7820313)(2.0721874,-3.8270311)(2.0671875,-3.8470314)
\curveto(2.0621874,-3.8670313)(2.0571876,-3.8920312)(2.0571876,-3.9070313)
}
\usefont{T1}{ptm}{m}{n}
\rput(2.3029687,-2.7770312){$60°$}
\pscustom[linewidth=0.04]
{
\newpath
\moveto(8.657187,-3.2070312)
\lineto(8.637188,-3.2570312)
\curveto(8.627188,-3.2820313)(8.607187,-3.3420312)(8.597187,-3.3770313)
\curveto(8.587188,-3.4120312)(8.577188,-3.4870312)(8.577188,-3.5270312)
\curveto(8.577188,-3.5670311)(8.577188,-3.6370313)(8.577188,-3.6670313)
\curveto(8.577188,-3.6970313)(8.577188,-3.7520313)(8.577188,-3.7770312)
\curveto(8.577188,-3.8020313)(8.577188,-3.8420312)(8.577188,-3.8870313)
}
\pscustom[linewidth=0.04]
{
\newpath
\moveto(8.637188,-2.5270312)
\lineto(8.527187,-2.5870314)
\curveto(8.472187,-2.6170313)(8.392187,-2.6870313)(8.3671875,-2.7270312)
\curveto(8.342188,-2.7670312)(8.282187,-2.8620312)(8.247188,-2.9170313)
\curveto(8.212188,-2.9720314)(8.167188,-3.0720313)(8.157187,-3.1170313)
\curveto(8.147187,-3.1620312)(8.127188,-3.2270312)(8.1171875,-3.2470312)
\curveto(8.107187,-3.2670312)(8.092188,-3.3270311)(8.087188,-3.3670313)
\curveto(8.082188,-3.4070313)(8.077188,-3.4820313)(8.077188,-3.5170312)
\curveto(8.077188,-3.5520313)(8.077188,-3.6170313)(8.077188,-3.6470313)
\curveto(8.077188,-3.6770313)(8.077188,-3.7420313)(8.077188,-3.7770312)
\curveto(8.077188,-3.8120313)(8.077188,-3.8570313)(8.077188,-3.8870313)
}
\usefont{T1}{ptm}{m}{n}
\rput(7.7829685,-3.0170312){$60°$}
\usefont{T1}{ptm}{m}{n}
\rput(8.3525,-3.6170313){$45°$}
\end{pspicture} 
}
\end{center}
\caption{Exemple simple d'application de la Trigonométrie.}
\label{fig:exempleapplictrigono}
\end{figure}
\end{boxedminipage}
\end{document}
As you can notice, it results in a ``Float(s) lost'' error. It is due to the draw. Anyway, I simply want to put both this draw and a given text in a boxedminipage environment. How can I manage to do this?

Any help would me much appreciated.
Last edited by latexforever on Sat Jul 11, 2009 3:30 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Using boxedminipage, but how can I put both txt and pict?

Post by localghost »

latexforever wrote:[…] Here is a MWE of what I am trying to do. […]
This is not an MWE because it contains packages and lines of code which are completely irrelevant for the problem.

It's enough to swap the figure and the boxedminipage environment.

Code: Select all

\begin{figure}[!ht]
  \begin{boxedminipage}
    % figure contents
  \end{boxedminipage}
\end{figure}
Though it works, I think the framed package is the better alternative.

The code for the figure could be cropped considerably if it is directly drawn with pstricks. Its capabilities are nowhere near good supported by LaTeXDraw.


Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Re: Using boxedminipage, but how can I put both txt and pict?

Post by latexforever »

Thanks. It worked. I gave such a NMWE because I was not able to find where my error was coming from.
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Using boxedminipage, but how can I put both txt and pict?

Post by localghost »

latexforever wrote:[…] I gave such a NMWE because I was not able to find where my error was coming from.
If you know the purpose of certain packages, you can estimate which of them are unnecessary.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english,frenchb]{babel}
\usepackage[svgnames]{pstricks-add}
\usepackage{boxedminipage}

\begin{document}
  \begin{figure}[!ht]
    \begin{boxedminipage}{\textwidth}
      Il faut déterminer la distance entre les points $C$ et $D$ à partir des données fournies sur la Figure \ref{fig:exempleapplictrigono}.

      \centering
      \begin{pspicture}[showgrid=false](-1,-1)(11,7)
        \small
        \SpecialCoor
        \psset{labelsep=5pt}
        \uput[d](5,0){10}
        \uput[dl](0;0){A} \psline(10;0) \psline(7.33;60) \psline(8.67;30)
        \uput[dr](10;0){B} \psline[origin={10;0}](5;120) \psline[origin={10;0}](8.96;135)
        \uput[ur](8.67;30){C} \uput[u](7.33;60){D}
        \psline(7.33;60)(8.67;30)
        \psarc(0;0){1}{0}{30} \psarc(0;0){2}{0}{60}
        \psarc(10;0){1}{135}{180} \psarc(10;0){2}{120}{180}
        \rput(1.3;15){\footnotesize 30\textdegree} \rput(2.3;45){\footnotesize 60\textdegree}
        \psset{labelsep=1cm} \uput[157.5](10;0){\footnotesize 45\textdegree}
        \psset{labelsep=2cm} \uput[150](10;0){\footnotesize 60\textdegree}
      \end{pspicture}
      \caption{Exemple simple d'application de la Trigonométrie.}\label{fig:exempleapplictrigono}
    \end{boxedminipage}
  \end{figure}
\end{document}
I think the pstricks code still can be done more elegant.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Using boxedminipage, but how can I put both txt and pict?

Post by latexforever »

localghost wrote:
latexforever wrote: I think the pstricks code still can be done more elegant.
I do agree with you, but I do not know PsTricks at the moment. It would be clearly better, and the difference would be significant.

Anyway, whatever the method, as I have redefined a example environment, I have a problem when putting this between \begin{exemple}\end{exemple} instructions. What can I do? The ``example title'' (as it would be for ``Definition'') is in the bottom of the picture.

Do you have any idea about this? Thanks.
Post Reply