Sorry for my original example code can not relect exactly what I mean. I have made a new one.
I am trying to define a new command, but it seems some unwanted extra spaces are generated together. Could you let me know how to remove them?
The test code:
\documentclass{article}
\usepackage{mulan}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\entrue
\jptrue
\cnfalse
\begin{document}
\title{\mulanp{Multilingual Document in English }{Multilingual Document in Japanese}{Multilingual Document in Chinese}}
\author{\mulanr{Name in English}{Name in Japanese}{Name in Chinese}}
\maketitle
\section{Title in English/Title in Japanese/Title in Chinese}
\section{\mulanr{Title in English}{Title in Japanese}{Title in Chinese}}
Example
\end{document}
The package I used here is as the following.
% Multi-language support package<mulan.sty>
%
% usage:
% \mulan[en,jp,cn,...]{seperator}{before}{after}{en-sentence}{jp-sentence}{cn-sentence}
%
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mulan}[2015/02/23 Multi-language support package version 0.0.1]
% if the language sequence is not given,
% given global language sequence \mulanseq will be used
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\Chinese{} %used to specify Chinese font
\newcommand\Japanese{} %used to specify Japanese font
\newcommand\Korean{} %used to specify Korean font
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\ifen \newif\iffr \newif\ifru \newif\ifjp \newif\ifcn \newif\ifkr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\en#1{\ifen\callsep #1\fi\langcmd} %
\def\fr#1{\iffr\callsep #1\fi\langcmd} %
\def\ru#1{\ifru\callsep #1\fi\langcmd} %
\def\jp#1{\ifjp\callsep {\Japanese #1}\fi\langcmd} %
\def\cn#1{\ifcn\callsep {\Chinese #1}\fi\langcmd} %
\def\kr#1{\ifkr\callsep {\Korean #1}\fi\langcmd} %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcounter{mulan@args}
\newcounter{mulan@argsmax}
\newcommand\mulan[4][en,jp,cn]{%
\gdef\mulan@thesep{#2}%
\gdef\mulan@thebefore{#3} %
\gdef\mulan@theafter{#4} %
\setcounter{mulan@args}{0}%
\setcounter{mulan@argsmax}{0}%
\commaparse#1,\relax%
\stepcounter{mulan@args}%
\expandafter\def\csname arg\romannumeral\value{mulan@args}\endcsname{relax}%
\setcounter{mulan@args}{0}%
\mulan@thebefore
\langcmd%
}
\def\commaparse#1,#2\relax{%
\stepcounter{mulan@args}%
\ifnum\value{mulan@args}>\value{mulan@argsmax} \setcounter{mulan@argsmax}{\value{mulan@args}} \fi %get the max number of arguments is
\expandafter\def\csname arg\romannumeral\value{mulan@args}\endcsname{#1}%
\if\relax#2\else\commaparse#2\relax\fi%
}
\newcommand\langcmd{%
\stepcounter{mulan@args}%
\ifnum\value{mulan@argsmax}<\value{mulan@args} \mulan@theafter \fi %
\csname\csname arg\romannumeral\value{mulan@args}\endcsname\endcsname%
}
\newcommand\callsep{\ifnum\value{mulan@args}>1\mulan@thesep\fi} %
%%%%=======================================================
\def\mulanp{\expandafter\mulan{\par}{}{}}
\def\mulanr{\expandafter\mulan{ \space {\textbf{/}}\space}{}{}}
\def\mulanTL{ \mulan{\\}{\begin{tabular}{@{}l@{}}}{\end{tabular}} }
\def\mulanTC{ \mulan{\\}{\begin{tabular}{@{}c@{}}}{\end{tabular}} }
\def\mulanTR{ \mulan{\\}{\begin{tabular}{@{}r@{}}}{\end{tabular}} }
It is a liitle long and difficult to understand. Please refer to the thread also for understanding <Parse command argument separated by comma>

\unskipafter#1solves one problem. You also need%in your definition of\mulan. – Werner Feb 24 '15 at 08:00\mulan– egreg Feb 24 '15 at 09:54\value{mulan@argsmax}and before\fi. Line 51: remove space before\mulan@theafter. Line 30 and 31: remove space at the end of line (shift the percent char left). Lines 18-23, 34, 39, 46, 51, 52, 55: the percent character is redundant here. Line 59: the double space before{\textbf{/}}and one\spaceafter it should be removed. – wipet Feb 24 '15 at 10:32