function factory( options ) {
	var opts;
	var err;
	opts = copy( defaults );
	err = validate( opts, options );
	if ( err ) {
		throw err;
	}
	if ( opts.inline ) {
		opts.format = 'inline-TeX';
		delete opts.inline;
	}
	return tex2svg;

	/**
	* Converts a TeX or LaTeX string to an SVG.
	*
	* @private
	* @param {string} str - string to convert
	* @param {Function} clbk - callback to invoke upon converting a string to an SVG
	* @throws {TypeError} first argument must be a string
	* @throws {TypeError} second argument must be a function
	* @returns {void}
	*/
	function tex2svg( str, clbk ) {
		if ( !isString( str ) ) {
			throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );
		}
		if ( !isFunction( clbk ) ) {
			throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );
		}
		opts.math = str;
		mathjax.typeset( opts, done );
		/**
		* Callback invoked upon converting a string to SVG.
		*
		* @private
		* @param {Object} data - output
		* @returns {void}
		*/
		function done( data ) {
			var err;
			if ( data.errors ) {
				err = new Error( data.errors[ 0 ] );
				return clbk( err );
			}
			clbk( null, data.svg );
		}
	}
}
Returns a function for converting a TeX or LaTeX string to an SVG.

@param {Options} options - function options
@param {PositiveInteger} [options.width=100] - container width in `ex`
@param {PositiveInteger} [options.ex=6] - `ex` size in pixels
@param {boolean} [options.inline=false] - specifies whether to format the input string as an inline equation
@param {boolean} [options.linebreaks=true] - enable linebreaking
@throws {TypeError} options argument must be an object
@throws {TypeError} must provide valid options
@returns {Function} function to convert a string to an SVG

@example
var opts = {
    'inline': true
};

var convert = factory( opts );

convert( 'y = mx + b', done );

function done( error, svg ) {
    if ( error ) {
        throw error;
    }
    console.log( svg );
}