General\DTLpar height

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Pangur
Posts: 29
Joined: Thu Jul 19, 2018 4:47 pm

\DTLpar height

Post by Pangur »

I have a text-based data file that contains the text of short prayers called collects. There is one for each Sunday of the year. The file contains dates in the left hand column, and the collects in the right hand column.

Using the datatool package, the template for a booklet I produce weekly for my wife is now able to look up the data file and pick the correct collect for any given date. That is all working well.

Such collects are usually are formatted with line-breaks to make them easy to read in short phrases. After trying several different suggestions as to how to create such line-breaks within the field, the only one that I could get to work for me was the command \DTLpar from datatool. This breaks the line without truncating the rest of the field. All that remains for me is to go through each collect, breaking it up into short phrases, each phrase ending with "\DTLpar". Though a little clumsy, it works fine.

When read into the booklet, they looks like normal line-breaks. However, \DTLpar is not governed by the line spacing that regulates the rest of the LaTeX document. The \DTLpar spacing appears to be fixed as 1.5 or double spacing. I would prefer to have single spacing, or less of a gap between the lines of the collect. I see nothing about that in the datatool manual, and I could not find any reference to it outside the manual.

Is there a way that I could reduce the default line-spacing produced by \DTLpar?

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

\DTLpar height

Post by Ijon Tichy »

Without Infominimal working example I can give you only some general information: \DTLpar is defined as

Code: Select all

\DeclareRobustCommand{\DTLpar}{\par}
so it uses the current \parindent, \parskip and \parfillskip. You can either change these lengths or redefine \DTLpar (again using \DeclareRobustCommand) to add positive or negative vertical space.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Pangur
Posts: 29
Joined: Thu Jul 19, 2018 4:47 pm

\DTLpar height

Post by Pangur »

I grateful for this helpful advice that you have given me, with several options. I shall try them and report back, probably later today.
Pangur
Posts: 29
Joined: Thu Jul 19, 2018 4:47 pm

\DTLpar height

Post by Pangur »

@Ijon Tichy, thanks very much for your help.

In the preamble, I added:

\DeclareRobustCommand{\DTLpar}{\par}

In the page, I have put:

{
\setlength{\parskip}{0\baselineskip plus 2pt}
\newcommand{\pubcoll}{\bliadhna-\mios-\latha}
\DTLfetch{goirid}{soy}{\pubcoll}{collect}
}


That did exactly what I wanted. Thank you.

However, I am curious about what the syntax might be to use \DeclareRobustCommand instead of \setlength{\parskip}.

Thanks, again for solving this for me.
Calum
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

\DTLpar height

Post by Ijon Tichy »

You should not need \DeclareRobustCommand{\DTLpar}{\par}, because it is the default.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Pangur
Posts: 29
Joined: Thu Jul 19, 2018 4:47 pm

\DTLpar height

Post by Pangur »

I have now removed \DeclareRobustCommand{\DTLpar}{\par}, as I note that it is not required.
Post Reply