Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My problem is similar to tabular tabularx automatic linebreak (p/m/b doesn't work as expected).

However he had some other issues that I don't have.

I have a two-column article. In this article I have a table with two columns, using the regular tabular environment.

The problem is that the second column doesn't automatically do the linebreaks, probably due to the fact that I set the paragraph width to \textwidth. I know I can fix this problem by setting something like 0.35\textwidth, however, this is something that is really bugging me.

Isn't there an option/parameter that just tells the last column (far right column), for example, to stop at the margin? I might want to adjust the size of the first column manually, but then, in this case, the second column, should just take the remaining space, up to the margin.

Here the MWE:

\documentclass[a4paper]{IEEEtran}

\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Here, main documents begins %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\title{FooBar}
\author{Bar Foo,~\IEEEmembership{foobar@google.com}}

% The paper headers
\markboth{FooBar 2013}%
{FooBar2013}

% make the title area
\maketitle

%% -----------------
%% |   Main part   |
%% -----------------

\lipsum

\noindent
\begin{tabular}{ r p{\textwidth} }
    & \\
    Step 1: & \lipsum[1] \\
    Step 2: & \lipsum[2] \\
    Step 3: & \lipsum[3] \\
    & \\
\end{tabular}

\end{document}
share|improve this question
    
I guess you're looking for tabularx provided by the package with the same name. –  egreg Jan 9 '13 at 11:29
    
@egreg Would you mind elaborating a little bit? I couldn't find a way to do it with tabularx either. –  cherrung Jan 9 '13 at 11:34
1  
\begin{tabularx}{\linewidth}{ r X} –  David Carlisle Jan 9 '13 at 11:38
1  
This would probably be better set as a description list that a table (which would allow page breaking and generally be more flexible) –  David Carlisle Jan 9 '13 at 11:39
    
\begin{tabularx}{\linewidth}{@{} r X @{}} –  Herbert Jan 9 '13 at 11:39

1 Answer 1

up vote 4 down vote accepted

Your list as a table and then as a list, note how the list version breaks into the second column of the page which a tabular can not do.

enter image description here

\documentclass[a4paper]{IEEEtran}

%\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lipsum,tabularx}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Here, main documents begins %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\title{FooBar}
\author{Bar Foo,~\IEEEmembership{foobar@google.com}}

% The paper headers
\markboth{FooBar 2013}%
{FooBar2013}

% make the title area
\maketitle

%% -----------------
%% |   Main part   |
%% -----------------

\lipsum

\section{aaa}
\noindent
\begin{tabularx}{\linewidth}{@{} r X @{}}
    Step 1: & \lipsum[1] \\
    Step 2: & \lipsum[2] \\
    Step 3: & \lipsum[3] \\
\end{tabularx}

\section{bbb}
\begin{description}
\item[Step 1]
 \lipsum[1]
\item[Step 2]
\lipsum[2]
\item[Step 3]
\lipsum[3]
\end{description}

\end{document}

alternative list settings


enter image description here

\makeatletter
\renewcommand*\@IEEEiedmakelabel[1]{\hspace\labelsep
                                \parbox[t][0pt][t]{\itemindent}{\raggedright\normalfont\bfseries #1}}
\makeatother


\begin{description}

enter image description here

\makeatletter
\renewcommand*\@IEEEiedmakelabel[1]{\hspace\labelsep
                                \makebox[\linewidth][l]{{\normalfont\bfseries #1}}}
\makeatother


\begin{description}
share|improve this answer
    
this doesn't prove your point very well. the tabularx version looks nicer to me than the description list ... try a shorter page, and put the list on a second page. (and fix the spacing between description label and text.) –  barbara beeton Jan 9 '13 at 13:52
    
@barbarabeeton yes the item spacing needs tidying up. I didn't as I wasn't sure if it really wanted to be step 1 2 3 in which case it should be enumerate with a custom label, eg enumerate package and \begin{enumerate}[Step 1: ] or if the real case was distinct text so it wants to be a description, there must be loads of answers on site about list formatting, I just wanted to highlight that it didn't have to be a table/ –  David Carlisle Jan 9 '13 at 14:12
    
@DavidCarlisle Thanks for the description option. However that doesn't seem to work, when the label is longer... It will just overlay with the text. –  cherrung Jan 9 '13 at 14:14
    
As I commented to barbara the list item handling in latex is very flexible, but it depends what you want, eg you can make it always start a new line, or start a new line after long heading or indent everything to the widest heading (if like in thebibliography you tell it the widest) or ... (the tabular case is even worse in that case as it squeezes up the other column with the long text) –  David Carlisle Jan 9 '13 at 14:32
1  
some alternatives coming up in the answer –  David Carlisle Jan 9 '13 at 15:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.