Discussion:
Can't resizebox with tabular* environment !
(too old to reply)
Louis
2004-01-26 22:00:33 UTC
Permalink
I'd like to use the tabular* environment to display a list of tracks so that
the track number & the song title are flush left and the track length flush
right (array width is \textwidth) ... the thing is , i'd like to prevent
LaTeX from wrapping the song titles, that's why i don't use tabularx
environment ... Though if a song title is very long (see the code below), i
can't use resizebox{\textwidth}{!}{...} to resize the array, i guess this is
because \begin{tabular*}{\textwidth}actually produces a box of width
\textwidth, no matter what's inside ...
Is there a way to make it work ?
Or can you think of another way to do it with the following constraints :
- track titles are not breaked, each one is on a single line
- some track titles can be very long (width>\textwidth)
- array width is \textwidth
- track title flush left
- track length flush right
( - plus \dotfill between track title and length ?)

Thank you for your answers !

\documentclass{minimal}
\usepackage[paperwidth=5cm,paperheight=13cm,nohead,nofoot,pdftex=true,margin
=0mm]{geometry} % note the paperwidth (i.e. textwidth)
\usepackage{array}
\usepackage{graphicx}
\setlength{\topskip}{0pt} \setlength{\parindent}{0pt}
\setlength{\parskip}{0pt} \setlength{\vskip}{0pt}
\pagestyle{empty}
\begin{document}
\resizebox{\textwidth}{!}{%
\begin{tabular*}{\textwidth}{r@{.}l@{\extracolsep{\fill}}r@{\extracolsep{0pt
}:}l}
1 & first track title & 12 & 23 \\
12 & Now this is a very very long title for a track fkj kj kj kjhfd kjh kjh
kjh kjh kh kjh kjh kjhhkjh kjh kh & 1 & 11 \\
145 & song \#3 & 3 & 00
\end{tabular*}%
}
\end{document}
Donald Arseneau
2004-01-26 23:14:06 UTC
Permalink
Post by Louis
- track titles are not breaked, each one is on a single line
- some track titles can be very long (width>\textwidth)
- array width is \textwidth
Perhaps you could illustrate how you envision that these constraints could
possibly be satisfied simultaneously!



Donald Arseneau ***@triumf.ca
Louis
2004-01-27 20:21:54 UTC
Permalink
ok ... i'll try to make myself clear : here are the constraints to be
satisfied

- track titles are not breaked, each one is _entirely_ _on a single line_

- array width is \textwidth, neither smaller nor bigger

- some track titles can be very long, _any length should work_ (i mean
length in number of chars)

- track number & track title are flush left

- track length is flush right

Of course i don't have any constraint on the font size, except : 0 < font
size <= maximum font size (say 10pt)

And LaTeX gurus can add the following couple of constraints :

- if possible i'd like to fill spaces with dots (\dotfill)

- extra constraint : No matter how many tracks there are, the whole array
must also fit in \textheight, i.e. array height <= \textheight (for this
last constraint, a simple \resizebox{\textwidth}{\textheight}{...} can't
make it, since i want to keep the font characters ratios
Post by Donald Arseneau
Post by Louis
- track titles are not breaked, each one is on a single line
- some track titles can be very long (width>\textwidth)
- array width is \textwidth
Perhaps you could illustrate how you envision that these constraints could
possibly be satisfied simultaneously!
Donald Arseneau
2004-01-27 22:55:57 UTC
Permalink
Post by Louis
- some track titles can be very long, _any length should work_ (i mean
length in number of chars)
Ah. So you did *not* mean to say "width>\textwidth".
Post by Louis
Of course i don't have any constraint on the font size, except : 0 < font
size <= maximum font size (say 10pt)
\resizebox*{\textwidth}{!}{%
\begin{tabular}{l<{\dotfill\ }l}
1 & Fame\\
2 & The persecution assassination of ...
\end{tabular}%
}

Also consider truncate.sty.


Donald Arseneau ***@triumf.ca
Louis
2004-01-28 23:14:29 UTC
Permalink
Thanks for your help, but this is not exactly what i want : if the track
titles are very short, then the resizebox makes the font too big : i've
tried this :

\documentclass{minimal}
\usepackage[paperwidth=13cm,paperheight=13cm,nohead,nofoot,pdftex=true,margi
n=0mm]{geometry}
\usepackage{graphicx}
\usepackage{array}
\setlength{\topskip}{0pt} \setlength{\parindent}{0pt}
\setlength{\parskip}{0pt} \setlength{\vskip}{0pt}
\pagestyle{empty}
\begin{document}
\resizebox*{\textwidth}{!}{%
\begin{tabular}{l@{.}l<{\dotfill\ }r}
1 & s1 & 23 \\
2 & s2 & 45
\end{tabular}%
}%
\end{document}

And if i don't use resizebox, then obviously the array is not wide enough
(we don't use tabular*{\textwidth}... )! i mean i'd like the macro to first
try with the default font size (say 10 pt), then if the whole array can fit
in \textwidth (and its width _must_ be \textwidth, the spaces are filled
with \dotfill), it's ok. But if the array can't fit in \textwidth, then the
array can be resized with resizebox (note that in this case, the font is
smaller, not bigger than the limit). i hope it's clear!

Loading...