Generalbeamer | Compilation with both LuaLaTeX and PDFLaTeX

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
wcw
Posts: 20
Joined: Thu Mar 08, 2012 12:35 pm

beamer | Compilation with both LuaLaTeX and PDFLaTeX

Post by wcw »

I have successfully compiled the beamer file with PDFLaTeX. But when I tried compiling the file with LuaLaTeX, I failed. The software I used is CTeX and the source code is added below. Can someone point out the reason why LuaLaTeX could not run the source code of my beamer:

Code: Select all

\documentclass[11pt]{beamer}

\usepackage[english]{babel}
\usepackage{graphics}
\usepackage{CJK}

\mode<presentation>
{
\usetheme{PaloAlto}
%\useoutertheme{tree}
\usecolortheme{lily}
\useinnertheme{rectangles}
\setbeamercovered{transparent}
\setbeamertemplate{blocks}[rounded][shadow=true]
}


\title{The Theory Concerning Droplet Generator}
\author{}
\institute{}

\begin{document}

\begin{CJK}{GBK}{song}

\begin{frame} % Cover slide
 \titlepage
\end{frame}

\frame{\frametitle{Table of Contents}\tableofcontents}

\section{Introduction to the Mechanism of Break-up}

\subsection{Young-Laplace Equation}
\begin{frame}

  \frametitle{Young-Laplace Equation}

  The Young-Laplace equation describes the capillary pressure difference sustained across the interface between two fluids.

  \begin{block}

    \begin{equation}
      \Delta p = T \bigl{(}\frac{1}{R_1} + \frac{1}{R_2} \bigr{)}
    \end{equation}

  \end{block}

  $\Delta p$: The capillary pressure difference between two liquids. \\
  $T$: The surface tension between two fluids, determined by the types of the fluids. \\
  $R_1$ \& $R_2$: The principle radii of curvature for the interface. \\

  \begin{figure}
      {
        \includegraphics[width=1.5in]{R1R2.png}
      }
    \end{figure}


\end{frame}

\subsection{The Mechanism for the Break-up of Liquid Jet}
\begin{frame}

  \frametitle{The Mechanism for the Break-up of Liquid Jet}

  \begin{columns}[c]
  \column{0.5\textwidth}
   \begin{block}{}
    \begin{figure}
      {
        \includegraphics[width=1.5in]{Rayleigh.png}
        %\caption{Intermediate stage of a jet breaking into drops}
%        \label{fig:Rayleigh}
      }
    \end{figure}
   \end{block}

  \column{0.5\textwidth}
    \begin{block}{The Young-Laplace Equation for $R_1$}

    \begin{equation*}
      \Delta p_{R_1} = T \bigl{(}\frac{1}{R_1} \bigr{)}
    \end{equation*}

   \end{block}

   \begin{itemize}
     \item We suppose $R_1$ is the radius of the liquid jet.
     \item Because $R_1$ at the trough is smaller, the pressure due to surface tension is increased.
     \item Because $R_1$ at the peak is bigger, the pressure due to surface tension is decreased.
   \end{itemize}
    %The Plateau-Rayleigh instability explains why and how a falling stream of fluid breaks up into smaller droplets. The Plateau-Rayleigh instability is derived based on the Rayleigh-Taylor instability. For our experiment, we utilize this method theory to decide the amplitude and frequency of the vibration, which perturbs the liquid jet generated by our droplet generator.
  \end{columns}

\end{frame}

\begin{frame}

  \frametitle{The Mechanism for the Break-up of Liquid Jet}

  \begin{columns}[c]
  \column{0.5\textwidth}
   \begin{block}{}
    \begin{figure}
      {
        \includegraphics[width=1.5in]{Rayleigh.png}
      }
    \end{figure}
   \end{block}

  \column{0.5\textwidth}

    \begin{block}{The Young-Laplace Equation for $R_2$}

    \begin{equation*}
      \Delta p_{R_2} = T \bigl{(}\frac{1}{R_2} \bigr{)}
    \end{equation*}

   \end{block}

   \begin{itemize}
     \item We suppose $R_2$ is the radius of curvature for the arc.
     \item Because $R_2$ at the trough is negative, the pressure due to surface tension is negative.
     \item Because $R_2$ at the peak is positive, the pressure due to surface tension is positive.
   \end{itemize}

  \end{columns}

\end{frame}

\begin{frame}

  \frametitle{The Mechanism for the Break-up of Liquid Jet}

  \begin{block}{}
    \begin{equation}
      \Delta p = \Delta p_{R_1} + \Delta p_{R_2} = T \bigl{(}\frac{1}{R_1} + \frac{1}{R_2} \bigr{)}
    \end{equation}
  \end{block}

  From the statement above, we could know that the values of $R_1$ and $R_2$ both determine the pressure difference.

  \begin{itemize}
  \item If $R_1$ dominates, the pressure at the trough is greater than that of the peak. The liquid will accumulate towards the peak and the liquid will break up.
  \item If $R_2$ dominates, the pressure at the peak is greater than that of the trough. The liquid will accumulate towards the trough and the liquid will not break up.
  \end{itemize}

  \bf What we are doing with droplet generator is to determine which radius of curvature will dominate, $R_1$ or $R_2$.

\end{frame}

\section{The Principle Formulae for Our Design}
\begin{frame}

  \frametitle{The Principle Formulae for Our Design}

  The principle formulae composed of the factors crucial to our design is:
  \begin{block}{}
   \begin{equation}
   d_{d} = 1.145 \cdot \bigl{(}\frac{v_j \cdot d_j^2}{f_{opt}}\bigr{)}^{\frac{1}{3}}
   \end{equation}
  \end{block}

  $d_{d}$: The diameter of the droplets broken up. \\
  $v_j$: The velocity of the liquid jet at the outlet of the nozzle.\\
  $d_j$: The diameter of the jet, which is not identical to the inner diameter of the nozzle.\\
  $f_{opt}$: The optimum frequency of the disturbance, which could be represented as a plane wave. \\
\end{frame}

\subsection{Derivation of the Disturbance}
\begin{frame}

  \frametitle{Derivation of the Disturbance}

  \begin{columns}[c]
  \column{0.5\textwidth}
   \begin{block}{}
    \begin{figure}
      {
        \includegraphics[height=0.8\textheight]{Wave.png}
      }
    \end{figure}
   \end{block}

  \column{0.5\textwidth}
   We suppose that $x$ direction is vertical and $y$ direction is perpendicular to $x$ direction. We could derived our equation of motion in $y$ direction:

   \begin{block}{Equation of Motion}
     \begin{equation}
      \rho \frac{\partial v}{\partial t} = \mu \frac{\partial^2 v}{\partial x^2}
     \end{equation}
   \end{block}

   $\rho$: The density of the liquid. \\
   $\mu$: The dynamic viscosity between the liquid and the air. \\
   $v$: The velocity of the wave in the direction of $y$.\\
   \end{columns}
\end{frame}

\begin{frame}

\frametitle{Derivation of the Disturbance}

\end{frame}

\subsection{Derivation of the Jet Velocity at the Outlet of the Nozzle}
\begin{frame}

  \frametitle{Derivation of the Jet Velocity at the Outlet of the Nozzle}

  According to the Bernoulli Equation,

  \begin{block}{The Bernoulli Equation}
   \begin{equation}
   H = z + \frac{p_1}{\rho g} + \frac{v_1^2}{2g} = h + \frac{p_2}{\rho g} + \frac{v_2^2}{2g}
   \end{equation}
  \end{block}

   $H$: The \textbf{hydraulic head} (压力水头) of the Bernoulli Equation, which is a constant. \\
   $p_1$ \& $p_2$: The pressures at two positions in the fluid. \\
   $v_1$ \& $v_2$: The velocities at two positions in the fluid. \\
   $z$: The elevation of the point above a reference plane. \\
   $h$: The energy loss of the liquid, which could be represented as:

   \begin{block}{The Energy Loss}
   \begin{equation}
   h = \gamma \frac{v_2^2}{2g} + \frac{32 D \mu v_2}{\rho g d_0^2}
   \end{equation}
  \end{block}
\end{frame}
\end{CJK}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

beamer | Compilation with both LuaLaTeX and PDFLaTeX

Post by localghost »

The short answer

It is not possible to make the same source compilable for both LuaLaTeX and PDFLaTeX at the same time.


The long answer

LuaLaTeX and PDFLaTeX are fundamentally different typesetting engines. For example, the way they access fonts is very important here. Whereas PDFLaTeX needs fonts e. g. in Type 1 format which have been specifically made available, LuaLaTeX can use OpenType or TrueType fonts which are installed on the operating system.

Another point is localization for documents for different languages. For PDFLaTeX there is the well known babel package to write documents in languages that differ from English. The respective counterpart for LuaLaTeX (and XeLaTeX as well) is the polyglossia package. Another point that comes with other languages than English is encoding. LuaLaTeX uses Unicode (UTF-8) by default.

As simple preamble for PDFLaTeX could look like the sample below. It only contains a simple setup with the cmbright font package. It's a sans serif font with support for text and math.

Code: Select all

\documentclass[smaller,professionalfonts,english]{beamer}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{mathtools}   %loads »amsmath«
\usepackage{cmbright}
A simple example for a preamble that can be used with LuaLaTeX is shown in the sample below. It uses the XITS font for normal text and math as well as Cantarell for a sans serif typeface and Inconsolata for typewriter font style. These fonts are all available for free and have to be installed as system font on the respective operating system.

Code: Select all

\documentclass[smaller,professionalfonts]{beamer}
\usepackage{fontspec,unicode-math}
\usepackage{polyglossia}
\setdefaultlanguage[%
  variant=american
]{english}
\usepackage{mathtools}   % loads »amsmath«

\setmainfont[Ligatures=TeX]{XITS}
\setsansfont[Ligatures=TeX,Scale=MatchLowercase]{Cantarell}
\setmonofont[Ligatures=TeX]{Inconsolata}
\setmathfont[Ligatures=TeX]{XITS Math}
If you now want to compile your present once with LuaLaTeX and once with PDFLaTeX, set up a corresponding preamble and include the body of your presentation by the \input command from an external file (*.tex) without any preamble.


Thorsten
wcw
Posts: 20
Joined: Thu Mar 08, 2012 12:35 pm

Re: beamer | Compilation with both LuaLaTeX and PDFLaTeX

Post by wcw »

Thanks for your replay. So the main difference between latex and LuaLaTeX is the setup of fonts, isn't it?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

beamer | Compilation with both LuaLaTeX and PDFLaTeX

Post by localghost »

It's only one. I would not consider it the main difference. But it is a striking one. Some important things take place backstage. I think you will get more detailed information on the home pages of LuaTeX and PDFTeX.
Post Reply