Last active
May 25, 2020 12:45
-
-
Save kauplan/e1bb6fc27b079421d41ecf6d46aee8e1 to your computer and use it in GitHub Desktop.
`\ifx`を含むcontrol sequenceを入れ子にすると、外側の`\ifxxx`と内側の`\else`が結びついてしまうため、エラー
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% -*- coding: utf-8 -*- | |
\documentclass[dvipdfmx,uplatex]{jsarticle} | |
\usepackage[deluxe]{otf} | |
\usepackage[T1]{fontenc} | |
\usepackage[utf8]{inputenc} | |
\usepackage{lmodern} | |
%%%%% | |
\newcommand{\ifempty}[1]{% | |
\edef\tempval{#1}% | |
\ifx\tempval\empty% | |
} | |
\def\sampleflag{Y} | |
\newcommand{\samplecommand}{SAMPLE} | |
\ifempty{\sampleflag}% | |
\renewcommand{\samplecommand}[1]{% | |
\ifempty{#1}% | |
EMPTY | |
\else% | |
NOT EMPTY %← ./main.tex:24: LaTeX Error: Missing \begin{document}. | |
\fi% | |
}% | |
\fi | |
%%%%% | |
\begin{document} | |
本文\par | |
\samplecommand | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment