
環境を次のように定義しました。引数が指定されていない場合は、垂直方向の空白を追加しないように変更したいと思います。
\documentclass[10]{article}
\usepackage[a4paper, margin=1in]{geometry}
\usepackage{tabu}
\usepackage{enumitem}
\setlist{leftmargin=5mm, noitemsep, topsep=-1\parskip}
\newenvironment{cvsection}[1]{
\vspace{3pt}
\hspace{3pt}{\scriptsize{\textbf{#1}}}
\vspace{2pt}
\hrule
}
\newenvironment{cvsubsection}[3]{
\vspace{-8pt}
\begin{center}
\begin{tabu} to 1\textwidth { X[l,m] X[c,m] X[r,m] }
\textbf{\small #1} & \textbf{\small #2} & \textbf{\small #3} \\
\end{tabu}
\end{center}
}
\begin{document}
\begin{cvsection}{LANGUAGES \& TECHNOLOGIES}
\begin{cvsubsection}{}{}{}
\begin{itemize}
\item C++; C; Java; Objective-C; C\#.NET; SQL; JavaScript; XSLT; XML (XSD) Schema
\item Visual Studio; Microsoft SQL Server; Eclipse; XCode; Interface Builder
\end{itemize}
\end{cvsubsection}
\end{cvsection}
\end{document}
上記は次のようになります。 に引数を指定しない場合は、赤でマークされた空白を削除したいと思います。cvsubsection
引数を指定すると、上記ですでに定義されているとおりに動作するはずです。
関連するコードによる望ましい出力(注: コードは、必要な出力を表示するためだけのものです。空の引数を渡す必要がありますcvsubsection
)
\begin{cvsection}{LANGUAGES \& TECHNOLOGIES}
% \begin{cvsubsection}{}{}{}
\vspace{4pt}
\begin{itemize}
\item C++; C; Java; Objective-C; C\#.NET; SQL; JavaScript; XSLT; XML (XSD) Schema
\item Visual Studio; Microsoft SQL Server; Eclipse; XCode; Interface Builder
\end{itemize}
% \end{cvsubsection}
\end{cvsection}
答え1
cvsubsection の最初の引数のみをチェックするアイデア (これが空の場合、他の引数も空になると思うので - 他の引数にもチェックを拡張するように遠慮なく依頼してください -)
\documentclass{article}
\usepackage{tabu}
\usepackage{enumitem}
\setlist{leftmargin=5mm, noitemsep, topsep=-1\parskip}
\newenvironment{cvsection}[1]{
\vspace{3pt}
\hspace{3pt}{\scriptsize{\textbf{#1}}}
\vspace{2pt}
\hrule
}
\newenvironment{cvsubsection}[3]{
\edef\FirstArg{#1}
\ifx\FirstArg\empty\vspace{-25pt}\fi
\begin{center}
\begin{tabu} to 1\textwidth { X[l,m] X[c,m] X[r,m] }
\textbf{\small #1} & \textbf{\small #2} & \textbf{\small #3} \\
\end{tabu}
\end{center}
}
\begin{document}
\begin{cvsection}{LANGUAGES \& TECHNOLOGIES}
\begin{cvsubsection}{}{}{}
\begin{itemize}
\item C++; C; Java; Objective-C; C\#.NET; SQL; JavaScript; XSLT; XML (XSD) Schema
\item Visual Studio; Microsoft SQL Server; Eclipse; XCode; Interface Builder
\end{itemize}
\end{cvsubsection}
\begin{cvsubsection}{Arg2}{Arg3}{Arg4}
\begin{itemize}
\item C++; C; Java; Objective-C; C\#.NET; SQL; JavaScript; XSLT; XML (XSD) Schema
\item Visual Studio; Microsoft SQL Server; Eclipse; XCode; Interface Builder
\end{itemize}
\end{cvsubsection}
\end{cvsection}
\end{document}