Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For a script that compiles LaTeX for me, I have to send the string \" to the command line, within a string delimited by ". Example:

>pdflatex "\IeC{\" o}"

How do I escape the " in the middle? If I do pdflatex "\IeC{\\" o}", the "\" will mean a \ and the string will still be terminated at the middle ". Any way around this?

Clarification: The literal string I want to send to pdflatex is \IeC{\"o}. After any escapes, this is what should be passed as command line argument.

share|improve this question
    
Your clarification omits a space. Is that a typo? –  Dennis Williamson Nov 3 '10 at 15:15
    
No, the clarification string is correct. However, I have other strings which need the space after a " that should*n't* terminate the string. –  Tomas Lycken Nov 10 '10 at 16:45
add comment

3 Answers

Use a carat as the escape character:

pdflatex "\IeC{^" o}"

Edit:

Try omitting the outer quotes:

pdflatex \IeC{\" o}

One thing to remember is that Windows doesn't process command line arguments the way a Linux/Unix shell does. The arguments are passed intact (including outer quotes) to the program which has to decide how it wants to process them. So you may need to escape the space. It all depends on how pdflatex sees the arguments.

share|improve this answer
    
Didn't work... =( –  Tomas Lycken Nov 3 '10 at 11:32
add comment
\\\"

To escape the first character, it is \\

To escape the second character, it is \"

So, just stick em together. \\\"

So, long story short, \\IeC{\\\"o}

I've never used pdflatex before, but that's how escapes work usually.

...unless the { and } need escapes too

share|improve this answer
add comment

You also need to escape the backslashes:

pdflatex "^\IeC{^\^" o}"

...but I am not sure if carets mean anything to LaTeX, which I think they probably do.

Alternatively, you could try using double quotes to contain the whole parameter, but I doubt they would work.

What would certainly work though, is modifying your pdflatex script to concatenate the %1 and %2 parameters (upto %n if needed) which you can then pass to the script without any quotes.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.