I want to replace -
with --
. I am able to replace \\
with --
using the following code:
{\def \\ {--\ } #3}
but if I try:
{\def - {--\ } #3} %Option 1
{\def- {--\ } #3} %Option 2
{\def-{--\ } #3} %Option 3
{\def - {{--\ }} #3} %Option 4
or any combination of the above, it causes
Missing control sequence inserted.
<inserted text>
\inaccessible
l.77 \begin
{rItemize}
in the part of the .tex
file:
\begin{rESubsection}
{text}
{text}
{\def \\ {--\ }{Start Date \\ End Date}}
\begin{rItemize} % here
\item text
\end{rItemize}
\end{rESubsection}
ChatGPT did not help even if it gave a running code. I tried all above code on different compilers versions of pdflatex
(2022, 2021, 2020) but to no avail.
Here is a full minimal working .tex
file on pdflatex
compiler version 2020 (legacy) on overleaf as per comments request.
\documentclass[11pt,letterpaper]{article} % Font size and paper type
\usepackage[parfill]{parskip} % Remove paragraph indentation
\usepackage{xparse} % used for any mmooo...
\usepackage{enumitem} % For rItemize left margin
\usepackage[left=0.4 in,top=0.4in,right=0.4 in,bottom=0.4in]{geometry} % Document margins
%\usepackage[margin=0.4in]{geometry}
\NewDocumentEnvironment{rSubsection}{mmmo}{
\textbf{#1}, {#2}\IfValueT{#4}{, \textit{#4}}. \hfill {\def \\ {--\ } #3}
\par
}{}
\NewDocumentEnvironment{rItemize}{
\begin{itemize}
\raggedright
}{
\end{itemize}
}
\begin{document}
%----------------------------------------------------------------------------------------
% Professional Experience
%----------------------------------------------------------------------------------------
\begin{rSubsection}
{Role}
{Company Name}
{Date - Date}
[Location]
\begin{rItemize}
\item Text.
\end{rItemize}
\begin{rSubsection}
{Role}
{Company Name}
{Date \\ Date}
[Location]
\begin{rItemize}
\item Text.
\end{rItemize}
\end{rSubsection}
\end{rSubsection}
\end{document}
\def-{...}
is not going to work. Please, add a full minimal example, becauserESubsection
is not a standard environment.~
) and you can not (easily) make-
active without breaking its use in numbers and lengths, or tikz syntax\NewDocumentEnvironment
needs 4 arguments! In your example the second argument with the<arg spec>
is missing (it can be empty forritemize
but it needs to be there otherwise LaTeX will complain about an invalid\begin
as argument specification.