Following a suggestion of @percusse, here's a (perhaps too) simple way:
\documentclass{article}
\usepackage{pgfplots}
\ifdim\overfullrule>0pt % draft option is active
\usepackage{environ}
\let\tikzpicture\relax
\let\endtikzpicture\relax
\NewEnviron{tikzpicture}{%
\begin{pgfpicture}
\pgfpathrectanglecorners{\pgfpointorigin}{\pgfpoint{3cm}{3cm}}%
\pgfusepath{stroke}\end{pgfpicture}%
}
\fi
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[thick] {x^2};
\end{axis}
\end{tikzpicture}
\end{document}
The draft
option sets \overfullrule
to 5pt. A safer way would be to check whether draft
appears in the global options, saved in \@classoptionslist
:
\makeatletter
\@tempswafalse
\def\@tempa{draft}
\@for\next:=\@classoptionslist\do
{\ifx\next\@tempa\@tempswatrue\fi}
\if@tempswa % draft option is active
\usepackage{environ}
\let\tikzpicture\relax
\let\endtikzpicture\relax
\NewEnviron{tikzpicture}{%
\begin{pgfpicture}
\pgfpathrectanglecorners{\pgfpointorigin}{\pgfpoint{3cm}{3cm}}%
\pgfusepath{stroke}
\end{pgfpicture}%
}
\fi
Of course a really satisfying solution would draw a box as wide as the picture it represents, provided the information is available, instead of a fixed rectangle.
There's a problem with the former solution: all \tikz...;
inline pictures will be transformed into boxes and some text would be lost. Here's a more complicated way to cope with this problem
\makeatletter
\@tempswafalse
\def\@tempa{draft}
\@for\next:=\@classoptionslist\do
{\ifx\next\@tempa\@tempswatrue\fi}
\if@tempswa % draft option is active
\usepackage{environ,etoolbox}
\let\tikz@@tikzpicture\tikzpicture
\let\tikz@@endtikzpicture\endtikzpicture
\patchcmd\tikz@opt{\tikzpicture}{\tikz@@tikzpicture}{}{}
\patchcmd\tikz@collectnormalsemicolon{\endtikzpicture}{\tikz@@endtikzpicture}{}{}
\chardef\@tempa=\catcode`\;
\catcode`\;=\active
\patchcmd\tikz@collectactivesemicolon{\endtikzpicture}{\tikz@@endtikzpicture}{}{}
\catcode`\;=\@tempa
\let\tikzpicture\relax
\let\endtikzpicture\relax
\NewEnviron{tikzpicture}{%
\begin{pgfpicture}
\pgfpathrectanglecorners{\pgfpointorigin}{\pgfpoint{3cm}{3cm}}%
\pgfusepath{stroke}
\end{pgfpicture}%
}
\fi
We save the original meanings of \tikzpicture
and \endtikzpicture
, patching the relevant macros to use the aliases.
Regarding the japanese you should imho use xecjk
and setup a suitable cjk-font. I don't have much fonts with japanese glyphs so I used Arial Unicode, but there are other.
(Side remark: The xecjk
version currently distribuated with miktex
doesn't work with the newest l3kernel
. You need to get the xecjk
from CTAN if you run into errors).
I don't understand which setup for the text fonts you actually want. Your mix of a serif font (Charis Sil) and a sans serif font (Source Sans Pro) is rather curious. As a general remark: There don't exist much fonts with a slanted and an italic version, so normally fontspec
maps the two commands to the same font. If you really want both types you can do something like this:
\documentclass[10pt]{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont[SlantedFont={Charis SIL},
SlantedFeatures={FakeSlant=0.2}]{Charis SIL}
\setsansfont[SlantedFont={Source Sans Pro},
SlantedFeatures={FakeSlant=0.2}]{Source Sans Pro}
\usepackage{xeCJK}
\setCJKmainfont{Arial Unicode MS}
\begin{document}
%Roman font Charis SIL:
hello world \textit{italic text} and \textsl{slanted text}.
Diacritics: șş țţ ȘŞ ȚŢ î Î ă Ă
%Sans serif font:
\sffamily
hello world \textit{italic text} and \textsl{slanted text}.
Diacritics: șş țţ ȘŞ ȚŢ î Î ă Ă
Japanese: 守 破 離
\end{document}
Best Answer
XeTeX does not have a draft mode. However, it compiles the PDF in two steps, first an extended DVI (XDV) is created and then converted by xdvipdfmx to PDF. The second step can be avoided by specifying option
--no-pdf
:The command line option can neither be set or asked at TeX macro level.