GeneralHelp with \if please

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

Help with \if please

Post by Pangur »

I have this piece of code which fetches from a file the title of a particular Sunday depending on the church calendar. (E.g., Easter, First Sunday of Epiphany, etc.) The sheet consists of various fields, where the field called "special" is the title of the day (e.g., "Candlemas" --- if the date is 2020-02-02).

I am able to access the file using \DTLfetch, and to place the result wherever I wish.

On the one hand, were the date 2020-02-02, it would show Candlemas, but, on the other hand, were the date to be 2020-08-02, nothing would be output, which is what I want, as it is not listed as a special day, and thus, the field "special" is empty for that date.

However, though there is no error message generated, I am conscious that my FALSE clause contains "When would this line ever be used?" and it never seems to appear. I am wondering if that means that my code just happens to work, and that my logic is flawed? Do I actually need the FALSE clause?

How could I tidy it up so that it works properly, please?

\if
{\DTLfetch{litdays}{soy}{\publicationdate}{special}}>{}
When would this line ever be used?
\else
{\DTLfetch{litdays}{soy}{\publicationdate}{special}}
\fi


soy = sunday-of-year(e.g., 2019-10-13 for this Sunday coming)

I do not think that the following information is relevant, but I share it anyway.
litdays is the database stored in my yearcycles.csv

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

Pangur
Posts: 29
Joined: Thu Jul 19, 2018 4:47 pm

Help with \if please

Post by Pangur »

I have realised that I do not need an \if ... \fi suite here. It has become obvious to me that it does not do anything for me, and that I do not require it.

All I need is:

{\DTLfetch{litdays}{soy}{\publicationdate}{special}}

and it is sufficient.

Sorry for not working this out before I posted.

Problem solved.
Post Reply