0

i want display only blank if do not found image, please don't display image path.

My minimal coding:

\RequirePackage{filecontents}
\begin{filecontents*}{file.tex}
 No,TextA
 1,Smile
 2,No
 3,


\end{filecontents*}

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{filecontents}
\usepackage{datatool}
\usepackage{wrapfig}
\usepackage{xparse}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{tcolorbox}
\tcbuselibrary{poster}
\usepackage{bbding}
\usepackage{pifont}
\usepackage{enumitem, setspace}
 \tcbset{colframe=blue!75!black,colback=white}
\DTLloaddb{file}{file.tex}
 \begin{document}

 \DTLforeach*
 {file}% Database
 {\No=No,\TextA=TextA}
 {%
 \begin{tcbposter}[
  poster = {
    columns=1,
    rows=1,
    spacing=3mm,
    height=14cm,
    width=12cm,
  },
]
%Box A

\posterbox[colframe=red,width=4.7cm,height=5.0cm]{name=A,column=1}{

\begin{enumerate}[leftmargin =-1em,rightmargin =-1em]
\item \includegraphics[width=3cm,height=3cm]{ImageA/\TextA.png}  \hfill abc


\end{enumerate}
}
\end{tcbposter}
\newline
}

\end{document}

enter image description here No image like transparent, not white color Thank in advance

  • 1
    Simple options ~ avoid using 3 ~ simplest of all have a whiteDummy.png and change line 3 to whiteDummy ~ not so easy to implement = use \if nul testing, so search this months entries for empty or blank csv. try one out possibly simple test if \TextA="" (i.e. nul entry) \if test{true}{false} – user170109 May 20 '19 at 16:52
  • 1
    How big a blank? [width=3cm, height=3cm]? \IfFileExists is easy compared to processing keywords. – John Kormylo May 20 '19 at 18:45
  • @KJO thank for your solution. But i want "transparent" if not image, not white color. Do you other solution, thanks – latexforti May 20 '19 at 22:52
  • @JohnKormylo i think i don't understand your solution. Can you please add to code? Thanks – latexforti May 20 '19 at 22:53
  • 1
    latexforti you can add a transparent image even if only same as a web tracker 1x1 pixel and per @JohnKormylo that's good \fileexist {name}{show}{noshow} should work well – user170109 May 20 '19 at 23:06
1

This solution takes advantage of the fact that \includegraphics and \adjustbox (mostly) use the same keywords.

\RequirePackage{filecontents}
\begin{filecontents*}{file.tex}
 No,TextA
 1,Smile
 2,No
 3,


\end{filecontents*}

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{filecontents}
\usepackage{datatool}
\usepackage{wrapfig}
\usepackage{xparse}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{tcolorbox}
\tcbuselibrary{poster}
\usepackage{bbding}
\usepackage{pifont}
\usepackage{enumitem, setspace}
 \tcbset{colframe=blue!75!black,colback=white}
\DTLloaddb{file}{file.tex}
\usepackage{adjustbox}

\newcommand{\mygraphics}[2][\empty]% #1 = \includegraphics options, #2=pathname
  {\IfFileExists{#2}{\includegraphics[#1]{#2}}{\adjustbox{#1}{\rule{1cm}{0pt}\rule{0pt}{1cm}}}}

 \begin{document}

 \DTLforeach*
 {file}% Database
 {\No=No,\TextA=TextA}
 {%
 \begin{tcbposter}[
  poster = {
    columns=1,
    rows=1,
    spacing=3mm,
    height=14cm,
    width=12cm,
  },
]
%Box A

\posterbox[colframe=red,width=4.7cm,height=5.0cm]{name=A,column=1}{

\begin{enumerate}[leftmargin =-1em,rightmargin =-1em]
\item \mygraphics[width=3cm,height=3cm]{ImageA/\TextA.png}  \hfill abc

\end{enumerate}
}
\end{tcbposter}
\newline
}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.