# Polyglot note-keeping?

I sometimes give roughly the same course in different languages, and update my TeX notes (if any) each time. Keeping all sets of notes current is a pain (and doesn´t always get done). Does anybody know of a system for keeping and updating the same math document in different languages? The text would vary and the math would be the same, except for eventual changes in order due to differences in sentence structure.

-

## 2 Answers

One option using the comment package results in

or

depending on which set of \includecomment and \excludecomment commands you use. Code as follows:

\documentclass{article}
\usepackage{comment}
\includecomment{spanish} \excludecomment{english}
%\excludecomment{spanish} \includecomment{english}

\begin{document}
\begin{english}
The Fourier series has the form:
\end{english}
\begin{spanish}
Las series de Fourier tienen la forma:
\end{spanish}
$\frac{a_0}{2} + \sum_{n=1}^{\infty} \left[ a_n \cos {\frac{2 n \pi}{T} t} + b_n \sin {\frac{2 n \pi}{T} t} \right]$
\begin{english}
where $a_n$ and $b_n$ are called Fourier coefficients of the Fourier series
of the function $f(x)$.
\end{english}
\begin{spanish}
donde $a_n$ y $b_n$ se denominan coeficientes de Fourier de la serie de
Fourier de la funci\'on $f(x)$.
\end{spanish}

\end{document}


Pardon my over-literal translation of the Spanish to English; Wikipedia's Fourier series pages (es, en) don't track that closely.

-

If you are using Emacs, org-mode can be a handy tool for you, for using XeLaTeX, you may refer to following example:

 % Created 2012-03-28 Wed 10:24
\documentclass[11pt]{article}
\usepackage[no-math]{fontspec}
\usepackage{mathspec}
\usepackage{xltxtra}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{amsmath}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{mathrsfs}
\usepackage[section]{algorithm}
\usepackage{algorithmic}
\usepackage{natbib}
\usepackage[colorlinks=true,pdfstartview=FitV,linkcolor=blue,citecolor=blue,urlcolor=blue]{hyperref}
\usepackage{xeCJK}
\setCJKmainfont[BoldFont={AR PL UKai TW}]{AR PL UMing TW}
\setCJKsansfont{Hiragino Sans GB}
\setCJKmonofont{cwTeXFangSongTT}
\providecommand{\alert}[1]{\textbf{#1}}

\title{Polygot Test}
\author{Gong-Yi Liao}
\date{\today}
\hypersetup{
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs Org-mode version 7.8.03}

\begin{document}

\maketitle

\setcounter{tocdepth}{3}
\tableofcontents
\vspace*{1cm}

\section{The first chapter}
\label{sec-1}

\underline{\{\fontspec{TakaoPGothic}ウソップ\}}  is one of the 海賊王角色, 源自

\end{document}

-