0

It would like to call the kdb command from Elektra from within LaTeX documents and use its output to write LaTeX conditionals.

Ideally, I would like to have something like:

\documentclass{article}
\usepackage{xifthen}
\usepackage{elektra}

\begin{document}
user/tests/examples is \kdb{user/tests/examples}

\ifthenelse{\kdbistrue{user/tests/examples}}%
        {true}%
        {false}

\ifthenelse{\kdbisnull{user/tests/examples}}%
        {key value is empty}%
        {key value is not empty}

\ifthenelse{\kdbispresent{user/tests/examples}}%
        {key is present}%
        {key is not present}

% should play well with standard xifthen features (like equal):
\ifthenelse{\equal{\kdb{user/tests/examples}}{something}}%
        {something}%
        {not something}
\end{document}

What I tried so far:

\documentclass{article}
\usepackage{xifthen}

\def \var {\input|"kdb sget user/tests/examples 0"}

\begin{document}
X\var{}X %works but adds additional spaces

\ifthenelse{\isin{0}{\var}}% does not work
        {false}%
        {true}

\ifthenelse{\equal{\var}{1}}% does not work
        {is 1}%
        {is not 1}

\ifthenelse{\isempty{\var}}}% does not work
        {empty}%
        {not empty}
\end{document}

Unfortunately I get "undefined control sequence" errors, except for the conditionals which use isin and isempty, which always return false.

Your Answer

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

Browse other questions tagged or ask your own question.