"""
Contains writer for writing nbconvert output to filesystem.
"""
#-----------------------------------------------------------------------------
#Copyright (c) 2013, the IPython Development Team.
#
#Distributed under the terms of the Modified BSD License.
#
#The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------

import io
import os
import glob

from IPython.utils.traitlets import Unicode
from IPython.utils.path import link_or_copy

from .base import WriterBase

#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------

class FilesWriter(WriterBase):
    """Consumes nbconvert output and produces files."""


    build_directory = Unicode(".", config=True, 
                              help="""Directory to write output to.  Leave blank
                              to output to the current directory""")


    # Make sure that the output directory exists.
    def _build_directory_changed(self, name, old, new):
        if new and not os.path.isdir(new):
            os.makedirs(new)


    def __init__(self, **kw):
        super(FilesWriter, self).__init__(**kw)
        self._build_directory_changed('build_directory', self.build_directory, 
                                      self.build_directory)
    
    def _makedir(self, path):
        """Make a directory if it doesn't already exist"""
        if not os.path.isdir(path):
            self.log.info("Making directory %s", path)
            os.makedirs(path)

    def write(self, output, resources, notebook_name=None, **kw):
            """
            Consume and write Jinja output to the file system.  Output directory
            is set via the 'build_directory' variable of this instance (a 
            configurable).

            See base for more...
            """

            # Pull the extension and subdir from the resources dict.
            output_extension = resources['output_extension']

            # Write all of the extracted resources to the destination directory.
            # NOTE: WE WRITE EVERYTHING AS-IF IT'S BINARY.  THE EXTRACT FIG
            # TRANSFORMER SHOULD HANDLE UNIX/WINDOWS LINE ENDINGS...
            for filename, data in resources.get('outputs', {}).items():

                # Determine where to write the file to
                dest = os.path.join(self.build_directory, filename)
                path = os.path.dirname(dest)
                self._makedir(path)

                # Write file
                self.log.debug("Writing %i bytes to support file %s", len(data), dest)
                with io.open(dest, 'wb') as f:
                    f.write(data)

            # Copy referenced files to output directory
            if self.build_directory:
                for filename in self.files:

                    # Copy files that match search pattern
                    for matching_filename in glob.glob(filename):

                        # Make sure folder exists.
                        dest = os.path.join(self.build_directory, filename)
                        path = os.path.dirname(dest)
                        self._makedir(path)

                        # Copy if destination is different.
                        if not os.path.normpath(dest) == os.path.normpath(matching_filename):
                            self.log.info("Linking %s -> %s", matching_filename, dest)
                            link_or_copy(matching_filename, dest)

            # Determine where to write conversion results.
            dest = notebook_name + '.' + output_extension
            if self.build_directory:
                dest = os.path.join(self.build_directory, dest)

            # Write conversion results.
            self.log.info("Writing %i bytes to %s", len(output), dest)
            with io.open(dest, 'w', encoding='utf-8') as f:
                f.write(output)
            return dest
IPython/nbconvert/writers/files.py
"""
Contains writer for writing nbconvert output to filesystem.
"""
#-----------------------------------------------------------------------------
#Copyright (c) 2013, the IPython Development Team.
#
#Distributed under the terms of the Modified BSD License.
#
#The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------

import io
import os
import glob

from IPython.utils.traitlets import Unicode
from IPython.utils.path import link_or_copy

from .base import WriterBase

#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------

class FilesWriter(WriterBase):
    """Consumes nbconvert output and produces files."""


    build_directory = Unicode("", config=True,
                              help="""Directory to write output to.  Leave blank
                              to output to the current directory""")


    # Make sure that the output directory exists.
    def _build_directory_changed(self, name, old, new):
        if new and not os.path.isdir(new):
            os.makedirs(new)


    def __init__(self, **kw):
        super(FilesWriter, self).__init__(**kw)
        self._build_directory_changed('build_directory', self.build_directory, 
                                      self.build_directory)
    
    def _makedir(self, path):
        """Make a directory if it doesn't already exist"""
        if not os.path.isdir(path):
            self.log.info("Making directory %s", path)
            os.makedirs(path)

    def write(self, output, resources, notebook_name=None, **kw):
            """
            Consume and write Jinja output to the file system.  Output directory
            is set via the 'build_directory' variable of this instance (a 
            configurable).

            See base for more...
            """

            # Pull the extension and subdir from the resources dict.
            output_extension = resources['output_extension']

            # Write all of the extracted resources to the destination directory.
            # NOTE: WE WRITE EVERYTHING AS-IF IT'S BINARY.  THE EXTRACT FIG
            # TRANSFORMER SHOULD HANDLE UNIX/WINDOWS LINE ENDINGS...
            for filename, data in resources.get('outputs', {}).items():

                # Determine where to write the file to
                dest = os.path.join(self.build_directory, filename)
                path = os.path.dirname(dest)
                self._makedir(path)

                # Write file
                self.log.debug("Writing %i bytes to support file %s", len(data), dest)
                with io.open(dest, 'wb') as f:
                    f.write(data)

            # Copy referenced files to output directory
            if self.build_directory:
                for filename in self.files:

                    # Copy files that match search pattern
                    for matching_filename in glob.glob(filename):

                        # Make sure folder exists.
                        dest = os.path.join(self.build_directory, filename)
                        path = os.path.dirname(dest)
                        self._makedir(path)

                        # Copy if destination is different.
                        if not os.path.normpath(dest) == os.path.normpath(matching_filename):
                            self.log.info("Linking %s -> %s", matching_filename, dest)
                            link_or_copy(matching_filename, dest)

            # Determine where to write conversion results.
            dest = notebook_name + '.' + output_extension
            if self.build_directory:
                dest = os.path.join(self.build_directory, dest)

            # Write conversion results.
            self.log.info("Writing %i bytes to %s", len(output), dest)
            with io.open(dest, 'w', encoding='utf-8') as f:
                f.write(output)
            return dest
IPython/nbconvert/writers/files.py
diff --git a/IPython/nbconvert/writers/files.py b/IPython/nbconvert/writers/files.py
index 440ccfe7760..c3d2656288a 100644
--- a/IPython/nbconvert/writers/files.py
+++ b/IPython/nbconvert/writers/files.py
@@ -30,7 +30,7 @@ class FilesWriter(WriterBase):
     """Consumes nbconvert output and produces files."""
 
 
-    build_directory = Unicode(".", config=True, 
+    build_directory = Unicode("", config=True,
                               help="""Directory to write output to.  Leave blank
                               to output to the current directory""")
 

under Windows, "ipython3 nbconvert "C:/blabla/first_try.ipynb" --to latex --post PDF" POST processing action fails because of a bad parameter
Hello,

The "one single step" option to create a ".pdf" from a .ipynb" fails on my windows python3 pc 

Nbconvert  apparently  tries compile ".TEX"  result with 

"pdflatex .\first_try.tex" 

==> It generates a bad behaviour of pdflatex, which picks "pdfTex" option instead of "PdfLatex".

The working option, on my Windows PC  and when I do it by hand, is not to put the ".\" 

"pdflatex first_try.tex" 

UPDATE : replacing ".\" per "./" seems also to be a solution.
"pdflatex ./first_try.tex" 

Hint to  the problem comes from here 
http://tex.stackexchange.com/questions/78178/miktex-how-to-run-pdflatex-from-cmd-prompt-on-windows-7-compared-to-windows-xp 

Details below.

Sheers

*\* instruction *\* 
ipython3 nbconvert "C:/blabla/first_try.ipynb" --to latex --post PDF"

**\* (start of the output ) ***
C:\Users\parent\Desktop\winpython\WinPython-32bit-3.3.2.1rc1\python-3.3.2>ipytho
n3 nbconvert "C:/blabla//first_try.ipynb" --to latex --po
st PDF
[NbConvertApp] Using existing profile dir: 'C:\Users\parent\Desktop\winpytho
n\WinPython-32bit-3.3.2.1rc1\settings\.ipython\profile_default'
[NbConvertApp] Converting notebook C:/blabla/first_try.ipynb to latex
[NbConvertApp] Support files will be in first_try_files\
[NbConvertApp] Loaded template latex_article.tplx
[NbConvertApp] Writing 53680 bytes to .\first_try.tex
[NbConvertApp] Building PDF: `pdflatex .\first_try.tex`
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/W32TeX)
 restricted \write18 enabled.
entering extended mode
! Undefined control sequence.
<_> .\first
           _try.tex
?
*_\* (end of the output ) ***

