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.

There are many Q&A's about left-aligning either table content-cells, or table captions. I'd like to left-align tables (or any/all floats for that matter). I would like to be able to tell that requirement in the preamble.

EDIT: My preamble looks like this (I've no idea what is generating this behaviour, so I'll just dump everything here. Generated by pandoc for the most part):

\documentclass{article}
\usepackage{amssymb,amsmath}
\usepackage[mathletters]{ucs}
\usepackage[utf8x]{inputenc}
\usepackage{array}
% This is needed because raggedright in table elements redefines \\:
\newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}
\let\PBS=\PreserveBackslash
\usepackage{graphicx}
% We will generate all images so they have a width \maxwidth. This means
% that they will get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins.
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
\else\Gin@nat@width\fi}
\makeatother
\let\Oldincludegraphics\includegraphics
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
\usepackage[breaklinks=true,unicode=true]{hyperref}
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setcounter{secnumdepth}{0}
\usepackage[finnish]{babel}
%\usepackage{times}
\usepackage{tgpagella}
\usepackage{tgheros}
\usepackage{fancyhdr}
\usepackage[font={sf,footnotesize}]{floatrow}
\usepackage{calc}
\floatsetup[table]{style=ruled,
  objectset=raggedleft,
  justification=raggedleft,
  margins=raggedright,
  midcode=captionskip,
  captionskip=10pt}
\pagestyle{fancy}
\usepackage[font={small,it},
  justification=justified,
  format=hang,
  labelfont={bf},
  singlelinecheck=false,
  labelsep=quad]{caption}
\usepackage[protrusion=true,expansion]{microtype}
share|improve this question
    
Tables and other floats should be left-aligned by default. If you are not seeing this then probably you are using a nonstandard \documentclass is that is doing something unusual. –  Lev Bishop Jan 25 '11 at 22:40
2  
Oh bummer, just ran it through without the wrapper to see how the output looks, and it looks like pandoc inserts \centering for every \begin{<<float>>}. I guess that makes my question a non-question, really, unless you can somehow counter the \centering inside preamble. –  morbusg Jan 25 '11 at 23:00
    
I haven't written a pandoc converter, but if you find out which directory they live in, you could start a new hg branch, copy the latex writer, grep for the \centering lines and remove those. –  jrhorn424 Mar 5 '11 at 20:07

3 Answers 3

up vote 6 down vote accepted

\let\centering\relax in the preamble will cancel \centering everywhere, or to be more selective and only cancel in floats, you can try

\makeatletter
\let\old@float\@float
\def\@float{\let\centering\relax\old@float}
\makeatother

You will still need to edit the \floatsetup{} line as lockstep described.

share|improve this answer
    
Awesome, thanks! –  morbusg Jan 26 '11 at 8:49

I had this problem when working with a table in Beamer that I wanted left-justified.

An easy hack I found was to place an \hfill\ after \end{tabular}. It fills all the way to the space (the \ after \hfill) and hence pushes the table to the left.

Of course this doesn't scale since you need to add \hfill\ every time.

share|improve this answer

The \floatsetup command of the floatrow package is the culprit. In your preamble, replace

\floatsetup[table]{style=ruled,
  objectset=raggedleft,
  justification=raggedleft,
  margins=raggedright,
  midcode=captionskip,
  captionskip=10pt}

with

\floatsetup[table]{style=ruled,
  objectset=raggedright,
  margins=raggedright,
  midcode=captionskip,
  captionskip=10pt}
\floatsetup[figure]{%
  objectset=raggedright,
  margins=raggedright,
  midcode=captionskip,
  captionskip=10pt}

for starters. Then decide if you really want to adopt different styles for tables and figures (and possible other float types). If not, replace my suggestion with one \floatsetup command (without [table] or [figure]).

EDIT: Just omitting \floatsetup will still produce horizontally centered floats - this is the default behaviour of floatrow.

share|improve this answer

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.