1
\documentclass[12pt]{article}
\usepackage[obeyspaces,spaces]{url}
\usepackage{indentfirst}
\usepackage{changepage}
\newlength{\anIndent}
\setlength{\anIndent}{\parindent}
\newcommand{\myPar}[1]
{
\begin{adjustwidth}{2\anIndent}{}
    \hspace{\anIndent}
    #1              
\end{adjustwidth}
}  

\begin{document}
\myPar
{
\path{C:\Data Temp\Cam.dat}
}
\end{document}

This is about as close to a MWE example as I can find. The problem here appears to be that the indentfirst and changepage packages are somehow changing something about how the url package works, and inserting an unwanted space after the "Cam" text in the path. Any ideas on how to fix? Thanks so much for your time!

1
  • 1
    The minimal example is \documentclass[12pt]{article} \usepackage[obeyspaces,spaces]{url} \newcommand\testcommand[1]{#1} \begin{document} \testcommand{\path{C:\Data Temp\Cam.dat}} \end{document} -- The issue depends one the fact that you are using \path as argument- Commented Feb 20, 2017 at 16:59

1 Answer 1

1

The provided commands by url are using equal mechanism like verbatim commands. So you have to handle it in a special way. In your case the package cprotect will help:

\documentclass[12pt]{article}
\usepackage[obeyspaces,spaces]{url}
\usepackage{cprotect}
\def\testcommand#1{#1{}}
\begin{document}
\cprotect\testcommand{\path{C:\Data Temp\Cam.dat}}

\testcommand{\path{C:\Data Temp\Cam.dat}}
\end{document}

Or in your case:

\documentclass[12pt]{article}
\usepackage[obeyspaces,spaces]{url}
\usepackage{indentfirst}
\usepackage{changepage}
\usepackage{cprotect}
\newlength{\anIndent}
\setlength{\anIndent}{\parindent}
\newcommand{\myPar}[1]
{
\begin{adjustwidth}{2\anIndent}{}
    \hspace{\anIndent}
    #1              
\end{adjustwidth}
}  

\begin{document}
\cprotect\myPar
{
\path{C:\Data Temp\Cam.dat}
}
\end{document}

Fore more information see: http://www.tex.ac.uk/FAQ-verbwithin.html

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .