I have a latex document in which i have a variable whose value i am passing from different file. Following is the main latex .tex file.

    %Project information
    \newcommand*{\Title}    {Build document}
    \newcommand*{\Document}     {None}
    \newcommand*{\Rev}      {False}

    \newcommand*{\VcsInstance}      {xyz}
    \newcommand*{\VcsLabel}     {sample}
    \newcommand*{\VcsBranch}        {${//my_branch/my_documentation}$}

when \VcsBranch is desplayed on pdf i get its value as:


The underscores are missing in it and its format is not correct. Variable "\VcsBranch" gets its value from a python script and it is actually contains the perforce branch details, so its sometimes e.g "//depot//file" or it can be "//stream_2015//example_2.15".So, i want "VcsBranch" to be set in a way that if value contains underscore it should also handle them properly.So suggest me what shall i add to the latex .tex document to get value printed in well format

  • Hi! It is not clear to me what you are passing from different file. Can you please add further details? Dec 16, 2015 at 19:02

1 Answer 1


I really don't like code only answers, but:


for underscores in normal text (to little surprise, if you've ever written LaTeX). Try to follow any LaTeX tutorial out there to learn what _ is normally used for, and how to interpret the errors that you should have noticed.