網頁

2014年3月20日 星期四

latex 使用 titlesec package 修改 section 標題時會影響 toc

解決方法

不使用titlesec,直接重新定義section 與 subsection

\makeatletter
\renewcommand{\section}{\@startsection
{section}%                   % the name
{1}%                         % the level
{\z@}%                       % the indent / 0mm
{-\baselineskip}%            % the before skip / -3.5ex \@plus -1ex \@minus -.2ex
{0.5\baselineskip}%          % the after skip / 2.3ex \@plus .2ex
{\hspace{25pt}\normalsize}} % the style
\makeatletter
\renewcommand{\subsection}{\@startsection
{subsection}%                   % the name
{1}%                         % the level
{\z@}%                       % the indent / 0mm
{-\baselineskip}%            % the before skip / -3.5ex \@plus -1ex \@minus -.2ex
{0.5\baselineskip}%          % the after skip / 2.3ex \@plus .2ex
{\hspace{50pt}\normalsize}} % the style

2014年3月18日 星期二

MathJax -- JavaScript display math engine

  • This is an inline math use \( \backslash ( \) and \( \backslash ) \) example: \( sin^\theta + cos^\theta = 1 \)

  • This is an display math use \( \backslash[ \) and \( \backslash[ \) example: \[ e^{i\theta} = cos\theta + isin\theta \]

  • If you want to know about the TeX Command(if the formula write by TeX) or MathML code just right click the formula.
For more information, please check the website MathJax

2014年3月4日 星期二

UVA 10295 - Hay Points

 #include <iostream>
 #include <cstdio>
 #include <cmath>
 #include <cstring>
 #include <climits>
 #include <vector>
 #include <string>
 #include <sstream>
 #include <algorithm>
 #include <map>
 #include <bitset>
 #define MAX 10000
 using namespace std;
 typedef long long int lli;
 
 int main(int argc, char *argv[]){
   int m, n;
   string word;
   int value;
   map<string, int> dictionary;
   map<string, int>::iterator it;
   cin >> m >> n;
 
   for (int i=0; i<m; ++i){
     cin >> word >> value;
     dictionary[word]=value;
   }
 
   string s;
   while (n--){
    int salary = 0;
    while (cin >> s && s!="."){
      it = dictionary.find(s);
      if (it!=dictionary.end())
        salary += it->second;
    }
    cout << salary << endl;
  }
  return 0;
}