1

I am designing an address book using the CSV parser in How to create form letters from spreadsheet data in ConTeXt?. Some persons have an academic title, while others not. Some also have a job address, others not. My layout depends on whether these data fields contain information or not. I can't figure out how to test, if a CSV field is empty or not. My first idea was to use something like \doifnotempty{\expanded{\insert[acadtitle]}{(\insert[acadtitle])}, but that always executes the command regardless whether the field is empty or not. Any hints? Thanks.

closed as off-topic by Henri Menke, Mensch, Stefan Pinnow, Bobyandbob, TeXnician Jan 30 '18 at 7:57

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Try \ifx\@empty#1 where #1 is what you are testing. Don't forget the \makeatletter ... \makeatother. – John Kormylo May 20 '15 at 18:13
  • @JohnKormylo I am using ConTeXt. How could I achieve this with the \doif commands? – Singulaere Entitaet May 20 '15 at 20:30
  • No idea. But the etoolbox package has \ifdefempty which is supposed to do the same thing. – John Kormylo May 21 '15 at 4:09
  • 2
    If \insert is an expandable command then \doifnotempty{\insert[acadtitle]} should work (no need to \expand). If it is unexpandable, then you can try \doiftextelse{\insert[acadtitle]}{true}{false}. If these don't work, then please post a minimal working example. – Aditya May 21 '15 at 5:14
  • 4
    I'm voting to close this question as off-topic because the issue was apparently caused by a malformatted CSV file. – Henri Menke Jan 30 '18 at 1:15

Browse other questions tagged or ask your own question.