Text FormattingIndenting a paragraph

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
lbv
Posts: 2
Joined: Wed Oct 28, 2009 4:39 am

Indenting a paragraph

Post by lbv »

Hello all,

First of all I have to say thank you to all the people who make this forum alive and tremendously useful for people like me who are still learning much of the magic of LaTeX.

Now, onto my problem :)..

I'm writing a simple document which I process through pdflatex to produce a PDF. In the document I have a series of tables listing a number of math axioms and theorems. So far so good.

Now I want the possibility to put brief notes below some theorems, adding extra information about them. Keep in mind that these notes are paragraphs that can span one or more lines, and they are inside a table. I want these notes to be in italics, and have a small indentation relative to the rest of the table cell (i.e. they should be a little to the right).

After some googling, I learned about {\addtolength{\leftskip}{measure} text}. So I tried something like:

Code: Select all

\begin{tabular}{l c p{7cm}}
  % ...

  blah & blah & $some math stuff here...$ \\
  & & {\addtolength{\leftskip}{0.2cm} My note...} \\

  % more rows like that...

\end{tabular}
It didn't work. I googled, and it turns out the indentation works if I place a \par before closing the last brace: {\addtolength{\leftskip}{measure} text \par}.

Ok, but now an undesirable side-effect shows up: the notes inside the table now have a whole blank line below them, and I don't know how to get rid of it. I've tried tweaking \parskip \parfillskip and some other stuff without really understanding what I'm doing, and no luck :).

I just want to indent a single paragraph of text, inside a table, without adding extra spacing below it, or affecting the rest of the table layout in strange ways. Anyway, I'm starting to think maybe \leftskip is not the best way to do what I want to do. Any ideas or suggestions? For reference, this is (a short version of) my document:

Code: Select all

\documentclass[8pt]{extarticle}
\usepackage[twocolumn,letterpaper,landscape,
            margin=1.1cm,columnsep=0.8cm]{geometry}
\usepackage{array}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{multirow}

\newcommand{\cuant}[3]{\ensuremath{(#1 #2 \mid : #3)}}
\newcommand{\tnote}[1]{{\addtolength{\leftskip}{0.2cm} \emph{#1} \par}}

\begin{document}

  \begin{tabular}{l c p{7cm}}
    \hline
    \hline
    \multicolumn{3}{l}{Axiomas} \\
    \multicolumn{3}{l}{(Definición 7.3)} \\
    \hline
    Término constante & Ax3 &
      $\cuant{\forall}{x}{P} \,\equiv\, P$ \\
    & & \tnote{si $x$ no es libre en $P$} \\
    Conjuntividad & Ax4 &
      $\cuant{\forall}{x}{P \land Q} \,\equiv\,
      \cuant{\forall}{x}{P} \land \cuant{\forall}{x}{Q}$ \\
    Reflexividad de $=$ & Ax5 &
      $x=x$ \\
    & & \tnote{para cualquier $x$} \\
    Principio de Leibniz ($P$) & Ax6 &
      $t=s \Rightarrow (P_t^x \equiv P_s^x)$ \\
    & & \tnote{
      para var. $x$ y términos $s$ y $t$ del mismo tipo, si $s$ y $t$ son
      libres para reemplazar $x$ en $P$
    }\\
    Principio de Leibniz ($t$) & Ax7 &
      $s=s' \Rightarrow t_s^x = t_{s'}^x$ \\
    & & \tnote{para var. $x$ y términos $t$, $s$ y $s'$ del mismo tipo}

  \end{tabular}
\end{document}
Thank you,
Leonardo
Last edited by lbv on Tue Nov 03, 2009 6:52 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
lbv
Posts: 2
Joined: Wed Oct 28, 2009 4:39 am

Indenting a paragraph

Post by lbv »

Okay, so after trying many different things, I found a solution that works as I wanted. The trick I ended up using was defining a \parbox with the width of the containing cell (or an approximate), and using \leftskip inside that parbox. I defined the \tnote command as follows:

Code: Select all

\newcommand{\tnote}[1]{{\parbox{\tnotelength}{%
                        \addtolength{\leftskip}{.25cm}%
                        \setlength{\parindent}{0cm} #1}}}
where \tnotelength is some arbitrary length I defined.

I'm attaching a small, working subset of my document for those who might be interested in seeing the result.

Thanks
Attachments
ex.tex
(1.32 KiB) Downloaded 333 times
Post Reply