Skip to content

Instantly share code, notes, and snippets.

@moewew
Last active July 3, 2020 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moewew/8ef53a51c97e52ab33a57c73eecbe5d5 to your computer and use it in GitHub Desktop.
Save moewew/8ef53a51c97e52ab33a57c73eecbe5d5 to your computer and use it in GitHub Desktop.
\documentclass{article}
\usepackage{etoolbox}
\newcommand{\fixsmpl}[1]{%
\edef\mytempstr{#1}%
\ifdefstring{\mytempstr}{l}%
{Sample runs from april to may}%
{\ifdefstring{\mytempstr}{s}
{Sample 2}
{\PackageError{fixsmpl}{Undefined option to fixsmpl command}{}}}%
}
\newcommand*\X{s}
\begin{document}
% Works fine
A\fixsmpl{s}
% Doesn't work
B\fixsmpl{\X}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment