title: Chinese in LaTeX
body: <p>2nd post on Stack Exchange, not 100% sure this is the correct place to post, but I'll move it if it needs to be moved.</p>
  
  <p>I've been trying to learn how to type up my Chinese documents in LaTeX (I use ShareLaTeX), but almost nothing seems to work. Although I have all of the proper Chinese fonts installed on the computer, it continues giving me errors, even when I tried to run the document that ShareLateX itself used for an example.</p>
  
  <p>Below are some documents and the errors/problems they cause. </p>
  
  <pre><code>\documentclass{article}
  \usepackage{CJK}
  \usepackage[utf8]{inputenc}
  
  \begin{document}
  
  \title{Title}
  \author{Author}
  \date{February 2015}
  
  
  \begin{CJK}{UTF8}{gbsn}
  
  
  你好\\
  文章内容\\
  Something\\
  再见\\
  
  \end{CJK}
  
  \end{document}
  </code></pre>
  
  <p>This gives out a document that is the closest I've had to success, but it doesn't print out in proper formatting (namely, the Title, Author and Date are all absent) and it doesn't have the usual margins.</p>
  
  <p>The next one was also stolen from an example</p>
  
  <pre><code>\documentclass{ctexart}
  
  \setCJKmainfont{simsun.ttf}
  \setCJKsansfont{simhei.ttf}
  \setCJKmonofont{simfang.ttf}
  
  \begin{document}
  
  \tableofcontents
  
  \begin{abstract}
  这是在文件的开头的介绍文字.本文的主要话题的简短说明.
  \end{abstract}
  
  \section{ 前言 }
  在该第一部分中的一些额外的元素可以被添加。巴贝尔包将采取的翻译服务.
  
  \section{关于数学部分}
  在本节中的一些数学会使用数学模型含中文字符显示。
  
  這是一個傳統的中國文字
  
  \end{document}
  </code></pre>
  
  <p>It returns the following error messages and fails to compile. All issues are in main.tex unless otherwise stated</p>
  
  <p>Compile Error
  Undefined Control Sequence (line 3)
  LaTeX Error: Missing \begin[document} (line 3)
  Undefined Control Sequence (line 5)
  Improper Alphabetic Constant (output.toc, line 1)
  Missing = inserted for \ifnum (output.toc, line 1)
  Missing number, treated as 0 (out..., line 1)
  Bad character code (-30). (out..., line 1)
  Undefined control sequence (line 12)
  Package CJK Error: Invalid Character Code (line 12)
  Undefined Control Sequence (line 15)
  Undefined Control Sequence (line 15)
  Undefined Control Sequence (line 16)
  Undefined Control Sequence (line 16)
  Undefined Control Sequence (line 19)
  Undefined Control Sequence (line 21)
  dfTeX error: pdflatex (file simsun.ttc): cannot open TrueType font file for reading</p>
  
  <p>Optimally, I'd like to use the KaiTi font, but for now I'll just settle for being able to created a document in the first place. :)</p>