Code: Select all
\documentclass[11pt,a4paper]{article}
\usepackage{gb4e}
\usepackage{xstring}
\def\ReplaceStr#1{%
\IfSubStr{#1}{XY}{%
\StrSubstitute{#1}{XY}{$\to$}}{#1}}
\begin{document}
\ReplaceStr{aXYbXYc}
\ReplaceStr{abc}
\end{document}
Code: Select all
\documentclass[11pt,a4paper]{article}
\usepackage{gb4e}
\usepackage{xstring}
\def\ReplaceStr#1{%
\IfSubStr{#1}{XY}{%
\StrSubstitute{#1}{XY}{$\to$}}{#1}}
\begin{document}
\ReplaceStr{aXYbXYc}
\ReplaceStr{abc}
\end{document}
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Code: Select all
\usepackage{xstring}
\usepackage{gb4e}
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis