LaTeX forum ⇒ 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, ...)
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

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

Postby latexforever » Sat Jul 11, 2009 1:59 pm

Hello,

I am using the boxedminipage package. Here is a MWE of what I am trying to do.
  1. \documentclass[10pt]{article}
  2. \usepackage[latin1]{inputenc}
  3. \usepackage{everyshi}
  4. \usepackage{amssymb}
  5. \usepackage{graphicx}
  6. \usepackage[usenames,dvipsnames]{pstricks}
  7. \usepackage[dvipsnames]{xcolor}
  8. %\usepackage{epsfig}
  9. \usepackage{fancybox}
  10. \usepackage{pst-grad} % For gradients
  11. \usepackage{pst-plot} % For axes
  12. %\usepackage{textcomp} % For degrees
  13. \usepackage{pst-text}
  14. \usepackage{pst-tree}
  15. \usepackage{pst-eps}
  16. \usepackage{pst-fill}
  17. \usepackage{pst-node}
  18. \usepackage{pst-math}
  19. \usepackage{psfrag}
  20. \usepackage{gensymb}
  21. \usepackage{lscape}
  22. \usepackage[usenames,dvipsnames]{pstricks}
  23. \usepackage{amsthm}
  24. \usepackage{lettrine}
  25. \usepackage{color}
  26. \usepackage{rotating}
  27. \usepackage{fancyhdr}
  28. \usepackage{boxedminipage}
  29.  
  30. \begin{document}
  31. \begin{boxedminipage}{\textwidth}
  32. Il faut déterminer la distance entre les points $C$ et $D$ à partir des données fournies sur la Figure \ref{fig:exempleapplictrigono}.
  33. % Generated with LaTeXDraw 2.0.1
  34. % Sun Apr 26 10:35:27 CEST 2009
  35. % \usepackage[usenames,dvipsnames]{pstricks}
  36. % \usepackage{epsfig}
  37. % \usepackage{pst-grad} % For gradients
  38. % \usepackage{pst-plot} % For axes
  39. \begin{figure}[!h]
  40. \begin{center}
  41. \scalebox{1} % Change this value to rescale the drawing.
  42. {
  43. \begin{pspicture}(0,-4.371406)(9.4775,4.371406)
  44. \psline[linewidth=0.04cm](0.3571875,-3.9470313)(6.9571877,1.9529687)
  45. \psline[linewidth=0.04cm](6.9571877,1.9529687)(3.4771874,3.9929688)
  46. \psline[linewidth=0.04cm](3.4571874,4.0129685)(9.157187,-3.8670313)
  47. \psline[linewidth=0.04cm](9.157187,-3.8670313)(6.9571877,1.9329687)
  48. \psline[linewidth=0.04cm](3.4771874,4.0129685)(0.3771875,-3.9270313)
  49. \psline[linewidth=0.04cm](0.3771875,-3.9270313)(9.157187,-3.8670313)
  50. \usefont{T1}{ptm}{m}{n}
  51. \rput(3.3771875,4.2029686){D}
  52. \usefont{T1}{ptm}{m}{n}
  53. \rput(7.124375,2.1629686){$C$}
  54. \usefont{T1}{ptm}{m}{n}
  55. \rput(0.12375,-3.9970312){$A$}
  56. \usefont{T1}{ptm}{m}{n}
  57. \rput(9.324375,-4.017031){$B$}
  58. \usefont{T1}{ptm}{m}{n}
  59. \rput(4.7696877,-4.2170315){$10$}
  60. \pscustom[linewidth=0.04]
  61. {
  62. \newpath
  63. \moveto(1.3771875,-3.0470312)
  64. \lineto(1.3771875,-3.1070313)
  65. \curveto(1.3771875,-3.1370313)(1.3621875,-3.2170312)(1.3471875,-3.2670312)
  66. \curveto(1.3321875,-3.3170311)(1.3021874,-3.4070313)(1.2871875,-3.4470313)
  67. \curveto(1.2721875,-3.4870312)(1.2421875,-3.5570312)(1.2271875,-3.5870314)
  68. \curveto(1.2121875,-3.6170313)(1.1821876,-3.6820312)(1.1671875,-3.7170312)
  69. \curveto(1.1521875,-3.7520313)(1.1221875,-3.8020313)(1.1071875,-3.8170311)
  70. \curveto(1.0921875,-3.8320312)(1.0621876,-3.8570313)(1.0471874,-3.8670313)
  71. \curveto(1.0321875,-3.8770313)(1.0071875,-3.8920312)(0.9771875,-3.9070313)
  72. }
  73. \usefont{T1}{ptm}{m}{n}
  74. \rput(1.5634375,-3.5170312){$30°$}
  75. \pscustom[linewidth=0.04]
  76. {
  77. \newpath
  78. \moveto(1.1371875,-1.9270313)
  79. \lineto(1.1771874,-1.9470313)
  80. \curveto(1.1971875,-1.9570312)(1.2721875,-2.0070312)(1.3271875,-2.0470312)
  81. \curveto(1.3821875,-2.0870314)(1.4921875,-2.1720312)(1.5471874,-2.2170312)
  82. \curveto(1.6021875,-2.2620313)(1.6871876,-2.3520312)(1.7171875,-2.3970313)
  83. \curveto(1.7471875,-2.4420311)(1.8121876,-2.5420313)(1.8471875,-2.5970314)
  84. \curveto(1.8821875,-2.6520312)(1.9521875,-2.7820313)(1.9871875,-2.8570313)
  85. \curveto(2.0221875,-2.9320312)(2.0671875,-3.0670311)(2.0771875,-3.1270313)
  86. \curveto(2.0871875,-3.1870313)(2.0971875,-3.2870312)(2.0971875,-3.3270311)
  87. \curveto(2.0971875,-3.3670313)(2.0971875,-3.4520311)(2.0971875,-3.4970312)
  88. \curveto(2.0971875,-3.5420313)(2.0971875,-3.6170313)(2.0971875,-3.6470313)
  89. \curveto(2.0971875,-3.6770313)(2.0921874,-3.7320313)(2.0871875,-3.7570312)
  90. \curveto(2.0821874,-3.7820313)(2.0721874,-3.8270311)(2.0671875,-3.8470314)
  91. \curveto(2.0621874,-3.8670313)(2.0571876,-3.8920312)(2.0571876,-3.9070313)
  92. }
  93. \usefont{T1}{ptm}{m}{n}
  94. \rput(2.3029687,-2.7770312){$60°$}
  95. \pscustom[linewidth=0.04]
  96. {
  97. \newpath
  98. \moveto(8.657187,-3.2070312)
  99. \lineto(8.637188,-3.2570312)
  100. \curveto(8.627188,-3.2820313)(8.607187,-3.3420312)(8.597187,-3.3770313)
  101. \curveto(8.587188,-3.4120312)(8.577188,-3.4870312)(8.577188,-3.5270312)
  102. \curveto(8.577188,-3.5670311)(8.577188,-3.6370313)(8.577188,-3.6670313)
  103. \curveto(8.577188,-3.6970313)(8.577188,-3.7520313)(8.577188,-3.7770312)
  104. \curveto(8.577188,-3.8020313)(8.577188,-3.8420312)(8.577188,-3.8870313)
  105. }
  106. \pscustom[linewidth=0.04]
  107. {
  108. \newpath
  109. \moveto(8.637188,-2.5270312)
  110. \lineto(8.527187,-2.5870314)
  111. \curveto(8.472187,-2.6170313)(8.392187,-2.6870313)(8.3671875,-2.7270312)
  112. \curveto(8.342188,-2.7670312)(8.282187,-2.8620312)(8.247188,-2.9170313)
  113. \curveto(8.212188,-2.9720314)(8.167188,-3.0720313)(8.157187,-3.1170313)
  114. \curveto(8.147187,-3.1620312)(8.127188,-3.2270312)(8.1171875,-3.2470312)
  115. \curveto(8.107187,-3.2670312)(8.092188,-3.3270311)(8.087188,-3.3670313)
  116. \curveto(8.082188,-3.4070313)(8.077188,-3.4820313)(8.077188,-3.5170312)
  117. \curveto(8.077188,-3.5520313)(8.077188,-3.6170313)(8.077188,-3.6470313)
  118. \curveto(8.077188,-3.6770313)(8.077188,-3.7420313)(8.077188,-3.7770312)
  119. \curveto(8.077188,-3.8120313)(8.077188,-3.8570313)(8.077188,-3.8870313)
  120. }
  121. \usefont{T1}{ptm}{m}{n}
  122. \rput(7.7829685,-3.0170312){$60°$}
  123. \usefont{T1}{ptm}{m}{n}
  124. \rput(8.3525,-3.6170313){$45°$}
  125. \end{pspicture}
  126. }
  127. \end{center}
  128. \caption{Exemple simple d'application de la Trigonométrie.}
  129. \label{fig:exempleapplictrigono}
  130. \end{figure}
  131. \end{boxedminipage}
  132. \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.

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sat Jul 11, 2009 2:41 pm

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.
  1. \begin{figure}[!ht]
  2. \begin{boxedminipage}
  3. % figure contents
  4. \end{boxedminipage}
  5. \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
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ 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

Postby latexforever » Sat Jul 11, 2009 3:30 pm

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: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sat Jul 11, 2009 3:55 pm

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.
  1. \documentclass[11pt,a4paper]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[latin1]{inputenc}
  4. \usepackage[english,frenchb]{babel}
  5. \usepackage[svgnames]{pstricks-add}
  6. \usepackage{boxedminipage}
  7.  
  8. \begin{document}
  9. \begin{figure}[!ht]
  10. \begin{boxedminipage}{\textwidth}
  11. Il faut déterminer la distance entre les points $C$ et $D$ à partir des données fournies sur la Figure \ref{fig:exempleapplictrigono}.
  12.  
  13. \centering
  14. \begin{pspicture}[showgrid=false](-1,-1)(11,7)
  15. \small
  16. \SpecialCoor
  17. \psset{labelsep=5pt}
  18. \uput[d](5,0){10}
  19. \uput[dl](0;0){A} \psline(10;0) \psline(7.33;60) \psline(8.67;30)
  20. \uput[dr](10;0){B} \psline[origin={10;0}](5;120) \psline[origin={10;0}](8.96;135)
  21. \uput[ur](8.67;30){C} \uput[u](7.33;60){D}
  22. \psline(7.33;60)(8.67;30)
  23. \psarc(0;0){1}{0}{30} \psarc(0;0){2}{0}{60}
  24. \psarc(10;0){1}{135}{180} \psarc(10;0){2}{120}{180}
  25. \rput(1.3;15){\footnotesize 30\textdegree} \rput(2.3;45){\footnotesize 60\textdegree}
  26. \psset{labelsep=1cm} \uput[157.5](10;0){\footnotesize 45\textdegree}
  27. \psset{labelsep=2cm} \uput[150](10;0){\footnotesize 60\textdegree}
  28. \end{pspicture}
  29. \caption{Exemple simple d'application de la Trigonométrie.}\label{fig:exempleapplictrigono}
  30. \end{boxedminipage}
  31. \end{figure}
  32. \end{document}

I think the pstricks code still can be done more elegant.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ 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

Postby latexforever » Sat Jul 11, 2009 8:33 pm

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.


Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 3 guests