Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
2_programmation:erreurs:not_in_outer_par_mode [2018/12/04 01:33]
jejust
— (Version actuelle)
Ligne 1: Ligne 1:
-====== Not in outer par mode ====== 
- 
- 
-For example: 
- 
-<code latex> 
-*\mbox{\marginpar{foo}} 
- 
-! LaTeX Error: Not in outer par mode. 
-</​code>​ 
-The error comes when you try to build something movable inside a box. 
-Movable things, in this context, are floating environments 
-(''​figure''​ and ''​table'',​ for example), and 
-''​\marginpar''​s. ​ LaTeX simply doesn'​t have the mechanisms for 
-floating out of boxes. ​ In fact, floats and ''​\marginpar''​s 
-themselves are built out of boxes, so that they can't be nested. 
- 
-If your error arises from ''​\marginpar'',​ you simply have to think of 
-an alternative way of placing the command; there is no slick solution. 
- 
-If a floating environment is the culprit, it may be possible to use 
-the ''​H''​ placement option, provided (for example) by the 
-[[ctanpkg>​float|float]] package: 
- 
- 
-<code latex> 
-\parbox{25cm}{% 
-  \begin{figure}[H] 
-  ... 
-  \caption{Apparently floating...} 
-  \end{figure}% 
-} 
-</​code>​ 
- 
-This example makes little sense as it stands; however, it is 
-conceivable that sane uses could be found (for example, using a 
-package such as [[ctanpkg>​algorithm2e|algorithm2e]] to place two algorithms 
-side-by-side). 
- 
- 
-Annother common occurrence is when the user wants a figure somewhere 
-inside a table: 
- 
-<code latex> 
-\begin{tabular}{|l|} 
-  \hline 
-  \begin{figure} 
-  \includegraphics{foo} 
-  \end{figure} 
-  \hline 
-\end{tabular} 
-</​code>​ 
-a construction that was supposed to put a frame around the diagram, 
-but doesn'​t work, any more than: 
- 
-<code latex> 
-\framebox{\begin{figure} 
-  \includegraphics{foo} 
-  \end{figure}% 
-} 
-</​code>​ 
-The problem is, that the ''​tabular''​ environment,​ and the 
-''​\framebox''​ command restrain the ''​figure''​ environment 
-from its natural métier, which is to float around the document. 
- 
-The solution is simply not to use the ''​figure''​ environment 
-here: 
- 
-<code latex> 
-\begin{tabular}{|l|} 
-  \hline 
-  \includegraphics{foo} 
-  \hline 
-\end{tabular} 
-</​code>​ 
-What was the float for? --- as written in the first two examples, it 
-serves no useful purpose; but perhaps you actually wanted a diagram 
-and its caption framed, in a float. 
- 
-It's simple to achieve this --- just reverse the order of the 
-environments (or of the ''​figure''​ environment and the 
-command): 
- 
-<code latex> 
-\begin{figure} 
-  \begin{tabular}{|l|} 
-    \hline 
-    \includegraphics{foo} 
-    \caption{A foo} 
-    \hline 
-  \end{tabular} 
-\end{figure} 
-</​code>​ 
-The same goes for ''​table''​ environments (or any other sort 
-of float you've defined for yourself) inside tabulars or box commands; 
-you //must// get the float environment out from inside, one way or 
-another. 
- 
- 
------ 
- 
-//Source:// [[faquk>​FAQ-parmoderr|Not in outer par mode]] 
- 
-{{htmlmetatags>​metatag-keywords=(LaTeX,​errors) 
-metatag-og:​title=(Not in outer par mode) 
-metatag-og:​site_name=(FAQ LaTeX francophone) 
-}} 
  
2_programmation/erreurs/not_in_outer_par_mode.1543883619.txt.gz · Dernière modification: 2018/12/04 01:33 par jejust
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0