GeneralAlignment Issues

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
chrisdb
Posts: 3
Joined: Sat Jun 07, 2008 7:46 pm

Alignment Issues

Post by chrisdb »

Hi,
I've been having a problem with Latex. I've been searching the internet with google and so far I haven't found a solution, so I thought I'd ask here.

What I'm trying to do is create a very simple set of commands for myself that will let me create a simple dictionary. Now, the usual format for a dictionary entry, in the dictionaries I have in my house, is for all lines after the first one to be slightly indented, which is the inverse of what Latex wants to do (indent the first line of a paragraph but not the rest). The reason for this is so that the start of each new word definition stands out. Below is a (silly) example:

Code: Select all

Dog [..] n. Large mammal. It has
   fur and a tail, and is commonly 
   known as man's best friend.
All I currently have is:

Code: Select all

\newcommand{\newentry}[4] {%
	 \begin{flushleft}
			{\bf #1} \textipa{[#2]} {\it #3} #4		
	 \end{flushleft}
	 }
Where argument 1 is the word, 2 is the pronunciation guide, 3 is the word class and 4 is the definition. I've tried playing with the margin settings within the definition of this command (changing the margin after {\bf #1} then changing it back at the end) in the hope that the new settings would come into effect when a new line was starting, but this doesn't seem to happen. The following code doesn't work:

Code: Select all

\newcommand{\newentry}[4] {%
	 \begin{flushleft}
			{\bf #1}
                       	\addtolength{\oddsidemargin}{5mm}
                 	\addtolength{\evensidemargin}{5mm}
                        \textipa{[#2]} {\it #3} #4		
                       	\addtolength{\oddsidemargin}{-5mm}
                 	\addtolength{\evensidemargin}{-5mm}
	 \end{flushleft}
	 }
I believe that what I probably need to do is insert a \indent whenever latex decides a new line is required, but I have no idea how to detect this. Is there a command that I can redefine temporarily to include indentation of the new line, for example?

I'm not a particularly sophisticated user of Latex, although I generally manage to get it to do what I want by experimentation and lots of Googling. This time, though, I just can't figure out how to get what I want.

I'd appreciate any help you could give.

Chris.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

chrisdb
Posts: 3
Joined: Sat Jun 07, 2008 7:46 pm

Re: Alignment Issues

Post by chrisdb »

OK, now I'm wondering if the simplest solution is to use the description environment, as someone on IRC suggested.
chrisdb
Posts: 3
Joined: Sat Jun 07, 2008 7:46 pm

Re: Alignment Issues

Post by chrisdb »

That doesn't work well though, because then I have no control over the amount of indentation that is applied to subsequent lines.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Alignment Issues

Post by Stefan Kottwitz »

Hi Chris,

the description environment is implemented in the article class this way:

Code: Select all

\newenvironment{description}
  {\list{}{\labelwidth\z@ \itemindent-\leftmargin
  \let\makelabel\descriptionlabel}}
{\endlist}
You could define your own environment similar by using the list environment.

Stefan
LaTeX.org admin
Post Reply