summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/hvfloat/hvfloat.tex
blob: 65bbf3882a4f54dd1c47484496475c66c0e34668 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
\listfiles
\documentclass{article}
\usepackage[T1]{fontenc} 
\usepackage[latin1]{inputenc} 
%\usepackage{mathptmx}
%\usepackage[scaled=0.92]{helvet}
\usepackage{courier}
\usepackage{comment}
\usepackage{listings}
%
\lstset{%
    language=[LaTeX]TeX,%
    showstringspaces=false,%
    tabsize=5,%
%    frame={tb},%
%    lineskip=-1pt,%
    extendedchars=true,%
    basicstyle={\footnotesize\ttfamily},%
    numbers=left,%
    stepnumber=1,%
    numberstyle=\tiny,%
%    xleftmargin=2em,%
    breaklines=true}
%
\usepackage[fbox]{hvfloat}
\usepackage{graphicx}
\usepackage{url}
\usepackage{tabularx}
\usepackage{lscape}
\usepackage{multicol}
\usepackage[pdftitle={hvfloat - Rotating Objects and Captions}, pdfauthor={Herbert Voß}, urlcolor=blue, linktocpage, a4paper, colorlinks=true]{hyperref}
%
\newcommand\CMD[1]{{\small\ttfamily\textbackslash{}#1}}
\newcommand\ENV[1]{{\small\ttfamily#1} Environment}
%
\begin{document}
\title{Package \texttt{hvfloat}\\Rotating objects and captions\\ver 1.1}
\author{Herbert Voß\thanks{\protect\url{voss@perce.de}}}
\date{\today}
\maketitle

\begin{abstract}
This \texttt{hvfloat.sty} defines a macro to place objects and captions of floats in different positions with different rotating angles.

All objects and captions are framed, which is only for demonstration here and has no additional sense.
\end{abstract}
\vfill

\hvFloat[%
	nonFloat=true,%
	capWidth=0.5,%
	capPos=r,%
	objectAngle=120,%
	capAngle=-210,%
	objectPos=c%
]{figure}{\fbox{\includegraphics[scale=0.9]{rose}}}{\fbox{What a nice Caption :-)}}{}

\vspace*{\fill}

\clearpage


\tableofcontents
\listoffigures

\clearpage
\section{The Package Options}

\noindent\begin{tabularx}{\textwidth}{lX}
\textbf{\small\texttt{fbox}} & The objects and captions are put into a \CMD{fbox} command, like in this documentation. This doesn't make real sense and is only for some demonstration useful.
\end{tabularx}

The length \CMD{belowcaptionskip} is set by \LaTeX{} to 0pt and changed in \texttt{hvfloat} to the same value than \CMD{abovecaptionskip}. This length can be changed to another value in the usual way with \CMD{setlength} or \CMD{addtolength}.

\section{The Macros}
The syntax for the \CMD{hvFloat} macro is
{\small\begin{verbatim}
\hvFloat[<options>]%
        {<float type>}%
        {<floating object>}%
        [<short caption>]{<long caption>}%
        {<label>}
\end{verbatim}}

If the second parameter \texttt{<float type>} is empty, then \texttt{hvfloat} switches by default to a nonfloat (see table \ref{tab:options}) object, which is not imprtant for the user. All other parameters may also be empty and the short caption as second optional parameter missing. This one is as usual the caption for the \verb|listoffigures|.

There are some more macros defined, more or less for internally use in \texttt{hvfloat}, but they can be used for own purposes.

{\small\begin{verbatim}
\figcaption[<short caption text>]{<caption text>}
\tabcaption[<short caption text>]{<caption text>}
\end{verbatim}}

They are used for the nonfloat option, where these macros write captions in the same way but outside of a float environment. The default caption cannot be used here. It is no problem to use the \CMD{tabcaption} command to place a caption anywhere, like here in an  inlined mode: \tabcaption[The Caption without sense ...]{A Caption without any sense and any object}\label{dummy} A label can be put inside the argument or after the command in the usual way, so that a reference to the not existing table \ref{dummy} is no problem.

{\small\begin{verbatim}
[...] It is no problem to use the \verb|\tabcaption| command to 
place a caption anywhere, like here in an  inlined mode: 
\tabcaption[The Caption without sense ...]{A Caption without any 
sense and any object}\label{dummy} A label can be put inside the 
argument or after the command in the usual way, so that a 
reference to  the not existing table \ref{dummy} is no problem.
\end{verbatim}}

\clearpage
\subsection{The Options}
There are following options:\\[1ex]
\begin{table}[!htb]
\caption{The Options for the Macro \texttt{hvFloat}}\label{tab:options}
\begin{tabularx}{\textwidth}{lcX}\hline
Option & Default &Description\\\hline
\texttt{floatPos} & \texttt{htb} & This is the same placement option like the one from the floats.\\
\texttt{rotAngle} & 0& The value for the angle if both, the object and the caption should be rotated in the same way.\\

\texttt{capWidth} & 0.8& The width of the caption. Can be "\texttt{w}" for the width of the object or "\texttt{h}" for the height of the object or a scale for \verb|\columnwidth|.\\

\texttt{capAngle} & 0 & The value for the angle if the caption should be rotated. Counted anti clockwise.\\

\texttt{capPos}& \texttt{b}& The position of the caption relative to the object. Possible values are (\textbf{l})eft|(\textbf{b})ottom|(\textbf{t})op|(\textbf{r})ight.\\

\texttt{capVPos}& \texttt{c}& This is only important for \texttt{capPos=l|r}. Only in this case the caption can vertically placed at the (\textbf{b})ottom|(\textbf{c})enter|(\textbf{t})op.\\

\texttt{objectPos} & \texttt{c} & The horizontalplacement of the object relative to the document. Possible values are (\textbf{l})eft|(\textbf{c})enter|(\textbf{r})ight.\\

\texttt{objectAngle} & 0 & The value for the angle if the object should be rotated. Counted anti clockwise.\\

\texttt{floatCapSep} & 5 & The additional width between the object and a left or right placed caption. The default unit is \texttt{pt}.\\

\texttt{useOBox} & \texttt{false} & Instead of passing the object as parameter to the \texttt{hvFloat}, the contents maybe saved in the box \texttt{\textbackslash hvOBox} With \texttt{useOBox=true} the contents of this box will be used.\\

\texttt{nonFloat} & \texttt{false} & The object isn't put in a floating environment. It is printed as standard text with an additional caption. The float counters are increased as usual and can be referenced.
\\\hline
\end{tabularx} 
\end{table}
 
\section{The Default Use of Floating Environments}
In this case there is no essential difference to the well known \texttt{figure} or \texttt{table} environment, f.ex.: 

{\small\begin{verbatim}
\begin{figure}
... object ...
\caption{...}% caption below the object
\end{figure}
\end{verbatim}}


\hvFloat{figure}{\includegraphics{rose}}{Without any Options (only the \texttt{fbox} package option)}{fig:0}

Code for figure \ref{fig:0}:
\begin{lstlisting}
\hvFloat{figure}{\includegraphics{rose}}{Without any Options (only the \texttt{fbox} package option)}{fig:0}
\end{lstlisting}


\hvFloat[capPos=t]{figure}{%
	\begin{tabularx}{\textwidth}{l|l|X}
		Name &	Type & Description\\\hline
		\texttt{hvFloat}  & command     & places object and caption in different ways\\
		\texttt{hvFloatEnv}  & environment & places object and caption exactly Here\\
		\texttt{figcaption} & command   & writes a figure caption in a non floating environment\\
		\texttt{tabcaption} & command   & writes a table caption in a non floating environment\\
		\texttt{setDefaults} & command  & sets all options to the defaults
	\end{tabularx}%
}{With the only Option \texttt{capPos=t} to place the caption on top of the table, which is often the default}{tab:0}

Code for table \ref{tab:0}:
\begin{lstlisting}[xrightmargin=-8em,xleftmargin=-3em]
\hvFloat[capPos=t]{figure}{%
	\begin{tabularx}{\textwidth}{l|l|X}
		Name &	Type & Description\\\hline
		\CMD{hvFloat} & command & places object and caption in different ways\\
		\texttt{hvFloatEnv}  & environment & places object and caption exactly Here\\
		\CMD{figcaption} & command & writes a figure caption in a non floating environment\\
		\CMD{tabcaption} & command & writes a table caption in a non floating environment\\
		\CMD{setDefaults} & command & sets all options to the defaults
		\end{tabularx}%
}{With the only Option \texttt{capPos=t} to place the caption on top of the table, which is often the default}{tab:0}
\end{lstlisting}

See section \ref{sec:tables} for some more informations about tabulars as objects.

\section{Caption Right or Left}
\hvFloat[%
	floatPos=htb,%
	capWidth=0.5,% of \columnwidth
	capPos=r,%
	capVPos=c,%
	objectPos=c]{figure}{\includegraphics{rose}}%
	[Caption beside object and vertically centered]{%
	Caption vertically centered right beside the float with a caption width of \texttt{0.5\textbackslash columnwidth} and \texttt{floatcapsep=5pt} (the default)}{fig:1}

Code for figure \ref{fig:1}:
\begin{lstlisting}
\hvFloat[%
	floatPos=htb,%
	capWidth=0.5,% of \columnwidth
	capPos=r,%
	capVPos=c,%
	objectPos=c]{figure}{\includegraphics{rose}}%
	[Caption beside object and vertically centered]{%
	Caption vertically centered right beside the float with a caption width of \texttt{0.5\textbackslash columnwidth} and \texttt{floatcapsep=5pt} (the default)}{fig:1}
\end{lstlisting}


\subsection{Caption Right and Rotated}
\hvFloat[%
	floatPos=htb,%
	capWidth=h,% of \columnwidth
	capPos=r,%
	capAngle=90,%
	capVPos=c,%
	objectPos=c]{figure}{\includegraphics{rose}}%
	[Centered Caption beside Object]{%
	Caption vertically centered right beside the float with a caption width of \texttt{0.5\textbackslash columnwidth} and \texttt{floatcapsep=5pt} (the default)}{fig:2}

Code for figure \ref{fig:2}:
\begin{lstlisting}
\hvFloat[%
	floatPos=htb,%
	capWidth=h,% of \columnwidth
	capPos=r,%
	capAngle=90,%
	capVPos=c,%
	objectPos=c]{figure}{\includegraphics{rose}}%
	[Centered Caption beside Object]{%
	Caption vertically centered right beside the float with a caption width of \texttt{0.5\textbackslash columnwidth} and \texttt{floatcapsep=5pt} (the default)}{fig:2}
\end{lstlisting}

It is no problem to rotate the object, too. But with a different angle value than for the caption. Do not ask for the sense, it is only a demonstration of what is possible ... The object (image) is rotated by $-30$ degrees with the \verb|rotatebox| makro.

\hvFloat[%
	floatPos=htb,%
	capWidth=h,% of \columnwidth
	capPos=r,%
	capAngle=180,%
	objectAngle=-30,%
	capVPos=c,%
	objectPos=c]{figure}{\fbox{\includegraphics{rose}}}
	[Centered Caption beside Object]{%
	Caption vertically centered right beside the float with a caption width of the height of the image and \texttt{floatcapsep=5pt} (the default)}{fig:3}

Code for figure \ref{fig:3}:
\begin{lstlisting}
\hvFloat[%
	floatPos=htb,%
	capWidth=h
	capPos=r,%
	capAngle=180,%
	objectAngle=-30,%
	capVPos=c,%
	objectPos=c]{figure}{\fbox{\includegraphics{rose}}}%
	[Centered Caption beside Object]{%
	Caption vertically centered right beside the float with a caption width of the height of the image and \texttt{floatcapsep=5pt} (the default)}{fig:3}
\end{lstlisting}

\section{Vertical Position of the Caption}
The caption can be placed beside the object in the psoitions 
\begin{verbatim}
(c)enter|(b)ottom|(t)op
\end{verbatim}

\hvFloat[%
	floatPos=htb,%
	capWidth=0.25,%
	capPos=r,%
	capVPos=b,%
]{figure}{\includegraphics{rose}}{Caption at bottom right beside the float}{fig:4}

The code for figure \ref{fig:4}:
\begin{lstlisting}
\hvFloat[%
	floatPos=htb,%
	capWidth=0.25,%
	capPos=r,%
	capVPos=b,%
]{figure}{\includegraphics{rose}}{Caption at bottom right beside the float}{fig:4}
\end{lstlisting}


\hvFloat[%
	floatPos=htb,%
	capWidth=0.25,%
	capPos=l,%
	capVPos=t,%
]{figure}{\includegraphics{rose}}{Caption at top left beside the float}{fig:5}

The code for figure \ref{fig:5}:
\begin{lstlisting}
\hvFloat[%
	floatPos=htb,%
	capWidth=0.25,%
	capPos=r,%
	capVPos=t,%
]{figure}{\includegraphics{rose}}{Caption at top left beside the float}{fig:5}
\end{lstlisting}

\hvFloat[%
	capWidth=0.25,%
	capPos=r,%
	capVPos=c,% the default
]{figure}{\includegraphics{rose}}{Caption centered right beside the float}{fig:6}

The code for figure \ref{fig:6}:
\begin{lstlisting}
\hvFloat[%
	capWidth=0.25,%
	capPos=r,%
	capVPos=c,% the default
]{figure}{\includegraphics{rose}}{Caption centered right beside the float}{fig:6}
\end{lstlisting}

\section{Horizontal Position of the Float}

\hvFloat[%
	capWidth=0.25,%
	capPos=r,%
	capVPos=t,%
	objectPos=l,%
]{figure}{\includegraphics{rose}}{%
	Caption at top right beside the float and object position left}{fig:7}

The code for figure \ref{fig:7}:
\begin{lstlisting}
\hvFloat[%
	capWidth=0.25,%
	capPos=r,%
	capVPos=t,%
	objectPos=l,%
]{figure}{\includegraphics{rose}}{%
	Caption at top right beside the float and object position left}{fig:7}
\end{lstlisting}


\hvFloat[%
	capWidth=0.25,%
	capPos=l,%
	capVPos=t,%
	objectPos=r,%
]{figure}{\includegraphics{rose}}{%
	Caption at top left beside the float and object position right}{fig:8}

The code for figure \ref{fig:8}:
\begin{lstlisting}
\hvFloat[%
	capWidth=0.25,%
	capPos=l,%
	capVPos=t,%
	objectPos=r,%
]{figure}{\includegraphics{rose}}{%
	Caption at top leftt beside the float and object position right}{fig:8}
\end{lstlisting}

\section{Full Page Width in Landscape Mode}
If you do not want to load the \texttt{lscape} package you can use the \texttt{floatPos=p} option to put the image on an own page and rotated by 90 degrees (figure \ref{fig:9}).

Code for figure \ref{fig:9}:
\begin{lstlisting}
\hvFloat[%
	floatPos=p,%
	capWidth=1,%
	capPos=b,%
	rotAngle=90,%
	objectPos=c%
]{figure}{\includegraphics[width=0.9\textheight]{bateaux}}{%
	Caption at top right beside the float and object position right}{fig:9}
\end{lstlisting}

The float can also be put to the left or to the right  (above/below in landscape) with the \texttt{objectPos=l} parameter

\hvFloat[%
	floatPos=p,%
	capWidth=1,%
	capPos=t,%
	rotAngle=90,%
	objectPos=c%
]{figure}{\includegraphics[width=\textheight]{bateaux}}{%
	Caption at top and together with the object rotated}{fig:9}



\hvFloat[%
	floatPos=p,%
	capWidth=h,%
	capPos=r,%
	objectAngle=90,%
	capAngle=-90,%
	objectPos=l%
]{figure}{\includegraphics[width=\textheight]{bateaux}}%
	[Rotated Caption]{%
	Caption right beside the float and object position left. The caption rotated by $-90$ degrees}{fig:10}

The code for figure \ref{fig:10}:
\begin{lstlisting}
\hvFloat[%
	floatPos=p,%
	capWidth=h,%
	capPos=r,%
	objectAngle=90,%
	capAngle=-90,%
	objectPos=l%
]{figure}{\includegraphics[width=\textheight]{bateaux}}%
	[Rotated Caption]{%
	Caption right beside the float and object position left. The caption rotated by $-90$ degrees}{fig:10}
\end{lstlisting}



\section{The \texttt{nonfloat} Option}
Sometimes it is better to put a "float" in a specific position of the page. This is possible with the \texttt{nonfloat} package and the option \texttt{nonFloat=true}. 

\begin{lstlisting}
\hvFloat[%
	nonFloat=true,%
	capWidth=0.25,%
	capPos=r,%
	capVPos=b,%
	objectPos=c,%
]{figure}{\includegraphics{rose}}%
	[Nonfloat Captions]{%
	Caption of a "nonfloat" Object, using the \texttt{nonfloat} Package}{fig:11}
\end{lstlisting}

\hvFloat[%
	nonFloat=true,%
	capWidth=0.25,%
	capPos=r,%
	capVPos=b,%
	objectPos=c,%
]{figure}{\includegraphics{rose}}%
	[Nonfloat Captions]{%
	Caption of a "nonfloat" Object, using the \texttt{nonfloat} Package}{fig:11}

\bigskip
The image \ref{fig:11} is exactly placed where the \texttt{hvFloat} command appears. There are only commands for \texttt{figure} and \texttt{table} environments:

\begin{lstlisting}
\newcommand{\figcaption}{\def\@captype{figure}\caption}
\newcommand{\tabcaption}{\def\@captype{table}\caption}
\end{lstlisting}

But it is no problem, to define more \texttt{xxxcaption} commands to support other with the \texttt{float} package defined new floats.

\section{Tables as Objects}\label{sec:tables}
The object has to be passed as an parameter to the \texttt{hvFloat} macro. This is no problem with images but maybe with tables, so it is easier to use the box \texttt{\textbackslash hvOBox} to save the table in this box and pass it then to \texttt{hvFloat} with the \texttt{useOBox} option. For example see table \ref{table:1} and \ref{table:2}:

\savebox{\hvOBox}{%
\begin{tabular}{l|l|l}
	Name &	Type & Description\\\hline
\texttt{hvFloat}  & command     & places object and caption in different ways\\
\texttt{hvFloatEnv}  & environment & places object and caption exactly Here\\
\texttt{figcaption} & command   & writes a figure caption in a non floating environment\\
\texttt{tabcaption} & command   & writes a table caption in a non floating environment\\
\texttt{setDefaults} & command  & sets all options to the defaults
\end{tabular}
}


\begin{lstlisting}[xrightmargin=-8em,xleftmargin=-3em]
\begin{tabular}{l|l|l}
	Name &	Type & Description\\\hline
	\texttt{hvFloat}  & command     & places object and caption in different ways\\
	\texttt{hvFloatEnv}  & environment & places object and caption exactly Here\\
	\texttt{figcaption} & command   & writes a figure caption in a non floating environment\\
	\texttt{tabcaption} & command   & writes a table caption in a non floating environment\\
	\texttt{setDefaults} & command  & sets all options to the defaults
\end{tabular}
}
\end{lstlisting}

The code for table \ref{table:1} and \ref{table:2} is: 
\begin{lstlisting}[xrightmargin=-7em,xleftmargin=-3em]
\hvFloat[%
	floatPos=!hb,%
	useOBox=true]{table}{}{Demonstration of the \texttt{useOBox} Parameter}{table:1}

\hvFloat[%
	floatPos=hb,%
	useOBox=true,%
	objectAngle=90,%
	capPos=r,%
	capVPos=t,%
	capWidth=0.3]{table}{}{Demonstration of the \texttt{useOBox} Parameter}{table:2}
\end{lstlisting}

In this case leave the third parameter empty.

\hvFloat[%
	floatPos=!hb,%
	useOBox=true]{table}{}{Demonstration of the \texttt{useOBox} Parameter}{table:1}

\hvFloat[%
	floatPos=!htb,%
	useOBox=true,%
	objectAngle=90,%
	capPos=r,%
	capVPos=t,%
	capWidth=0.3]{table}{}{Demonstration of the \texttt{useOBox} Parameter}{table:2}


\section{Text and Objects}\label{sec:text}

With the \texttt{onlyText} option it is no problem to put some text beside an image without getting the caption titels figue/table. The object still can be a floating one or a nonfloating if the \texttt{nonfloat} is used.

\hvFloat[%
	onlyText=true,%
	capAngle=90,%
	capPos=r,%
	capVPos=t,%
	capWidth=h]{}{\includegraphics{rose}}%
	["\texttt{onlyText}" Caption]{%
	Demonstration of the \texttt{onlyText} Parameter, which makes it 
	possible to put some text beside a floating object without getting 
	a starting \texttt{Figure:} or \texttt{Table:}}{fig:text}

The code for figure \ref{fig:text}:


\begin{lstlisting}
\hvFloat[%
	onlyText=true,%
	capAngle=90,%
	capPos=r,%
	capVPos=t,%
	capWidth=h]{}{\includegraphics{rose}}%
	["\texttt{onlyText}" Caption]{%
	Demonstration of the \texttt{onlyText} Parameter, which makes it 
	possible to put some text beside a floating object without getting 
	a starting \texttt{Figure:} or \texttt{Table:}}{fig:text}
\end{lstlisting}



\section{Environment \texttt{hvFloatEnv}}\label{sec:env}

With the environment \texttt{hvFloat} one can place an object exactly on that position where the
environment is defined. For captions the use of \CMD{captionof} is recommended:

\begin{hvFloatEnv}
\captionof{table}{A caption for a nice table}
\begin{tabular}{@{} l c r @{}}\hline
left & center & right \\
L    & C      & R     \\\hline
\end{tabular}
\end{hvFloatEnv}

\begin{lstlisting}
\begin{hvFloatEnv}
\captionof{table}{A caption for a nice table}
\begin{tabular}{@{} l c r @{}}\hline
left & center & right \\
L    & C      & R     \\\hline
\end{tabular}
\end{hvFloatEnv}
\end{lstlisting}

The environment has an optional argument for setting the line width which is preset to \CMD{textwidth}.
The object is always centered.

\begin{hvFloatEnv}[0.5\textwidth]
\captionof{table}{A caption for a nice table}
\begin{tabular}{@{} l c r @{}}\hline
left & center & right \\
L    & C      & R     \\\hline
\end{tabular}
\end{hvFloatEnv}

\begin{lstlisting}
\begin{hvFloatEnv}[0.5\textwidth]
\captionof{table}{A caption for a nice table}
\begin{tabular}{@{} l c r @{}}\hline
left & center & right \\
L    & C      & R     \\\hline
\end{tabular}
\end{hvFloatEnv}
\end{lstlisting}



\appendix
\section{Problems}
\begin{itemize}
\item[] With the \texttt{nonfloat} option all objects are left aligned, \verb|\centering| doesn't work here. Only God knows why ...\hfill \textbf{solved!}
\end{itemize}


\section{The Package Source}
\lstinputlisting[basicstyle=\ttfamily\footnotesize,tabsize=3]{hvfloat.sty}


\end{document}