I want to define distinct fonts for text and math. I used this code
\documentclass{beamer}
\renewcommand {\rmdefault }{ibh}
\usepackage{fontspec}
\setmainfont{Segoe Print}
\usefonttheme[onlymath]{serif}
\renewcommand\sfdefault{cmbr}
\begin{document}
\begin{frame}
Some text, $x^2 + y^2 = r^2$
\end{frame}
\end{document}
but it has a inverse result:
How can i correct it?
You may need the package lmodern too:
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{fontspec}
\setmainfont{Segoe Print}
\usefonttheme{serif}
\begin{document}
\begin{frame}
Some text, $x^2 + y^2 = r^2$
\end{frame}
\end{document}
This code, compiled with LuaLaTeX, gives:
Also, check the option no-math of package fontspec.
Related
I'm using the beamer class to create slides and using the lstlisting package inside a colorbox. Below is a reproducible example showing my problem when using pdflatex. I'm trying to use quotes (") as in the line read.csv(c:'//path') and the compiler breaks. Things works when the quotes are removed.
Does anyone see a way to solve that problem?
\documentclass[]{beamer}
\usepackage{colortbl}
\usepackage{bm}
\usepackage{color}
\usepackage{amssymb,amsmath}
\usepackage{mathtools}
\usepackage{float}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage{listings}
\lstset{basicstyle=\ttfamily}
\usepackage{tcolorbox}
\usepackage{graphicx}
\usepackage{fancybox}
\usepackage{hyperref}
% For formatting R code
\lstset{language=R,
basicstyle=\small\ttfamily,
stringstyle=\color{DarkGreen},
otherkeywords={0,1,2,3,4,5,6,7,8,9},
morekeywords={TRUE,FALSE},
deletekeywords={data,frame,length,as,character},
keywordstyle=\color{blue},
commentstyle=\color{DarkGreen},
xleftmargin=.0in,
breaklines=true,
xrightmargin=.25in
}
\newcommand{\qq}{\symbol{34}}
%\documentclass[handout]{beamer}
\mode<handout>
{
\usetheme{default}
}
\mode<presentation>
{
\usetheme{Madrid}
%\usetheme{default}
}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
%\usepackage{SweaveSlides}
\usepackage{bm}
\usepackage{graphicx}
\usefonttheme[onlymath]{serif}
%\logo{\includegraphics[width=3cm]{logo.jpeg}}
\title{Title}
\author {Name\\Place}
\institute[Place]{
}
\date[Test]{Test}
\subject{OP}
\AtBeginSubsection[]%
{
\begin{frame}<beamer>
\frametitle{Outline}
\tableofcontents[currentsection,currentsubsection]
\end{frame}
}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}[fragile]
\frametitle{Title}
\begin{itemize}
\item Item 1
\end{itemize}
\begin{tcolorbox}[colback=red!5,colframe=red!75!black,title=Reading in a .csv File]
\lstset{tabsize=2}
\begin{lstlisting}
read.csv('c://test')
\end{lstlisting}
\end{tcolorbox}
\end{frame}
\end{document}
Hello I trying to list the subsections in table of contents (beamer), but I can't get the result ? Anyone knows how to do it ?
My code (I am using the \usetheme{CambridgeUS}):
\documentclass[handout,10pt,aspectratio=169]{beamer}
\usepackage[spanish]{babel}
\usepackage{multirow,rotating}
\usepackage{color}
\usepackage{hyperref}
\usepackage{tikz-cd}
\usepackage{array}
\usepackage{siunitx}
\usepackage{mathtools,nccmath}%
\usepackage{etoolbox, xparse}
\usecolortheme{dolphin}
\usepackage{lipsum}
\usepackage{natbib}
\usepackage{hyperref}
\usepackage{calc}
\usepackage{environ}
\usepackage{courier}
\usepackage{tcolorbox}
\usetheme{CambridgeUS}
\title[]{\textcolor{black}{\vskip 1.5cm\textbf {Title}}}
\begin{document}
\begin{frame}
\maketitle
\end{frame}
\begin{frame}
\frametitle{Contenido}
\tableofcontents
\end{frame}
\section{Introducción}
\begin{frame}{Introducción}
\subsection{sismos lentos}
\end{frame}
\end{document}
Never use sectioning commands like \section or \subsection within a frame. They must be used outside the frame.
Apart from this problem, you can use https://stackoverflow.com/a/74094309/2777074 to get squares in the toc:
\documentclass[handout,10pt,aspectratio=169]{beamer}
\usepackage[spanish]{babel}
\usepackage{multirow,rotating}
%\usepackage{color}
%\usepackage{hyperref}
\usepackage{tikz-cd}
\usepackage{array}
\usepackage{siunitx}
\usepackage{mathtools,nccmath}%
\usepackage{
%etoolbox,
xparse}
\usecolortheme{dolphin}
\usepackage{lipsum}
\usepackage{natbib}
%\usepackage{hyperref}
\usepackage{calc}
\usepackage{environ}
\usepackage{courier}
\usepackage{tcolorbox}
\usetheme{CambridgeUS}
\title[]{\textcolor{black}{\vskip 1.5cm\textbf {Title}}}
\setbeamertemplate{sections/subsections in toc}[square]
\begin{document}
\begin{frame}
\maketitle
\end{frame}
\begin{frame}
\frametitle{Contenido}
\tableofcontents
\end{frame}
\section{Introduccion}
\subsection{sismos lentos}
\begin{frame}{Introduccion}
\end{frame}
\end{document}
So I have the following document:
\include{preamble}
\title{test title}
\begin{document}
\maketitle
\begin{equation*}
\begin{aligned}
\pi\sqrt{\pi\sqrt{\pi\sqrt{\pi\sqrt{\pi\sqrt{\pi\dots}}}}}
\end{aligned}
\end{equation*}
\bibliographystyle{plain}
\bibliography{references}
\end{document}
the contents of my preamble.tex file is:
%%%%% Document Setup %%%%%%%%
\documentclass[10pt,onecolumn]{revtex4} % Font size (10,11 or 12pt) and column number (one or two).
\usepackage{times} % Times New Roman font type
\usepackage[a4paper, left=1.85cm, right=1.85cm,top=1.85cm, bottom=1.85cm]{geometry} % Defines paper size and margin length
\usepackage[font=small, labelfont=bf]{caption} % Defines caption font size as 9pt and caption title bolded
\usepackage{graphics,graphicx,epsfig,ulem} % Makes sure all graphics works
\usepackage{amsmath} % Adds mathematical features for equations
\usepackage{etoolbox} % Customise date to preferred format
\usepackage{subcaption}
\usepackage{caption}
\makeatletter
\patchcmd{\frontmatter#RRAP#format}{(}{}{}{}
\patchcmd{\frontmatter#RRAP#format}{)}{}{}{}
\renewcommand\Dated#name{}
\makeatother
\usepackage{fancyhdr}
\def\bibsection{\section*{References}} % Position reference section correctly
\usepackage{import}
\usepackage{pdfpages}
\usepackage{transparent}
\usepackage{xcolor}
\newcommand{\incfig}[2][1]{%
\def\svgwidth{#1\columnwidth}
\import{./figures/}{#2.pdf_tex}
}
\pdfsuppresswarningpagegroup=1
For some reason the title just will not be included on the pdf when I compile the code, I am sure I have \title{} and \maketitle in the correct positions. Any help as to why this is would be much appreciated.
Move the title after \begin{document}:
\documentclass{revtex4}
\begin{document}
\title{test title}
\maketitle
\end{document}
(don't do this with other documentclasses. Most of the time it is better to have the \title in the preamble, e.g. to get sensible pdf meta data if combined with hyperref)
I am using Latex for the first time and I am preparing a slide using 'beamer'. What happening is that some of my citations, tables and long equations are exceeding beyond the text width, though it wasn't the problem when the document class was 'article'. My tables aren't long, as one of them has only 3 rows and 6 columns.
The latex codes are
\documentclass[9pt]{beamer}
\mode<presentation> {
\usefonttheme{serif}
\usetheme{Madrid}
\definecolor{BlueGreen}{cmyk}{0.85,0,0.33,0}
\colorlet{beamer#blendedblue}{BlueGreen!120}}
\usepackage{booktabs}
\usepackage{caption}
\hypersetup{pdfnewwindow}
\setbeamertemplate{caption}[numbered]
\setbeamerfont{frametitle}{size=\footnotesize}
\setbeamertemplate{navigation symbols}{}
\setbeamercolor{postit}{bg=violet!110}
\usepackage{ragged2e} %new code
\addtobeamertemplate{block begin}{}{\justifying}
\usepackage{textpos}
\begin{document}
\begin{frame} \frametitle{\textbf{{\Large Objective}}}
\begin{itemize}
\justifying
\item This package gives you easy access to the Lorem Ipsum dummy text; an option is available to separate the paragraphs of the dummy text. This text \cite{kumar2015method}.
\item The long equation is:
\begin{equation}
A(\theta,\alpha) = \dfrac{ A*{-(\alpha*A)}\beta*{(\delta-1)} \left(A* \hspace{1mm}\hspace{1mm}C^{-A Z_{H}} \hspace{1mm}C^{-C^{-A *Z_{H}}} \prod_{i=1}^{m-1} \left( \dfrac{ A \hspace{1mm}C^{-A* Z_{u(i)}} C^{-C^{-A* Z_{u(i)}}}}{1- \frac{1}{C-1} (C^{1-C^{-A Z_{u(i)}}}-1)}\right) \right) }{ \int_{0}^{\infty} C^{-(\alpha *A)}(A^{(\beta-1)} \left( A* \hspace{1mm}\hspace{1mm}C^{-A Z_{H}} \hspace{1mm}C^{-C^{-A Z_{H}}} \prod_{i=1}^{B-1} \left(\dfrac{ A \hspace{1mm}C^{-A Z_{u(i)}} C^{-C^{-A* Z_{u(i)}}}}{1- \frac{1}{C-1} (C^{1-C^{-A* Z_{u(i)}}}-1)}\right) \right) A} .
\end{equation}
\end{itemize}
\end{frame}
\bibliography{ref}
\bibliographystyle{plainnat}
\end{document}
And the contents of the .bib file is:
#article{kumar2015method,
title={This is the title of the article},
author={Kumar, Dinesh and others},
journal={This is Journal},
volume={2},
number={3},
pages={150-180},
year={2015}
}
If you use the plainnat bib style, you should also load the natbib package. This will automatically allow line breaks
you don't need the caption package, beamer provides it's own mechanism to customise captions
you must place the bibliography inside a frame
for the very large equation, I would suggest to replace the fraction with (...) \times (...)^{-1}, this way you can split it over multiple lines. In addition you'll probably want to use a smaller font size and maybe remove all the manual spaces.
\documentclass[9pt]{beamer}
\mode<presentation> {
\usefonttheme{serif}
\usetheme{Madrid}
\definecolor{BlueGreen}{cmyk}{0.85,0,0.33,0}
\makeatletter
\colorlet{beamer#blendedblue}{BlueGreen!120}
\makeatother
}
\usepackage{booktabs}
%\usepackage{caption}
\hypersetup{pdfnewwindow}
\setbeamertemplate{caption}[numbered]
\setbeamerfont{frametitle}{size=\footnotesize}
\setbeamertemplate{navigation symbols}{}
\setbeamercolor{postit}{bg=violet!110}
\usepackage{ragged2e} %new code
\addtobeamertemplate{block begin}{}{\justifying}
\usepackage{natbib}
\usepackage{textpos}
\begin{document}
\begin{frame} \frametitle{\textbf{{\Large Objective}}}
\begin{itemize}
\justifying
\item This package gives you easy access to the Lorem Ipsum dummy text; an option is available to separate the paragraphs of the dummy text. This text \cite{kumar2015method}.
\item The long equation is:
\end{itemize}
\end{frame}
\begin{frame}
\bibliography{ref}
\bibliographystyle{plainnat}
\end{frame}
\end{document}
How can I print on Epson L4160, or any other printer the presentation made in Latex connected with Beamer, having scale of frame 16:9? My trouble is strange, because I don't want to have a white bars... But, what I have discovered, on the preview in Adobe Reader, in full screen preview it looks very good...
Snapshot of printing:
Snapshot of fullscreen presentation:
And code: (due to many lines, I can paste it on other page if it is necessary)
\documentclass[polish,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{polski}
\usepackage{ragged2e} %justify
\usepackage[inline]{enumitem}
\usepackage{multicol}
\usepackage{gensymb} %degree
\usepackage{colortbl} %color of row
\usepackage{cancel} %fraction cancel line
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{url} %bibliography
\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{scalerel}
\DeclareMathOperator*{\Bigcdot}{\scalerel*{\cdot}{\bigodot}}
\usetikzlibrary{positioning, calc}
\usetheme{Warsaw}
\definecolor{myAmber}{rgb}{1.0, 0.49, 0.0} %#FF7E00
\usecolortheme[named=myAmber]{structure}
\setlength{\parindent}{0pt}
\title{Wprowadzenie do matematyki}
\subtitle{2. Koniunkcja i alternatywa w zdaniach.}
\author{Konstanty Dmochowski}
%\date{}
\expandafter\def\expandafter\insertshorttitle\expandafter{%
\insertshorttitle\hfill \hspace*{3.85cm}%
\insertframenumber\,/\,\inserttotalframenumber}
\makeatletter
\long\def\beamer##ssection*#1{\beamer#section[]{}}
\makeatother %remove section both from header and outline in beamer
\newcommand{\lcancel}[2]{\cancel{#1}_{#2}}
\newcommand{\ucancel}[2]{\cancel{#1}^{#2}}
\newcommand*{\rechterWinkel}[3]{% #1 = point, #2 = start angle, #3 = radius
\draw[shift={(#2:#3)}] (#1) arc[start angle=#2, delta angle=90, radius = #3];
\fill[shift={(#2+45:#3/2)}] (#1) circle[radius=2.5\pgflinewidth];
}
%\special{pdf:encrypt ownerpw (prezentacjaPL2020) userpw (prezentacja2020) length 128 perm 2052}
\AtBeginSection[]
{
\begin{frame}
\frametitle{Plan pracy}
\tableofcontents[currentsection]
\end{frame}
}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{Plan pracy}
\tableofcontents
\end{frame}
\section{Wprowadzenie}
\begin{frame}{O czym będziemy mówili?}
\begin{figure}[h!]
\begin{center}
\includegraphics[scale=0.2]{idea-3383766_1280.jpg}
\end{center}
\caption{Jak sądzicie?}
\end{figure}
\end{frame}
\begin{frame}{Przypomnienie}
\justify
Do tej pory mówiliśmy wyłącznie o \textbf{zdaniach logicznych} i ich \textbf{zaprzeczeniach}.
\\[0.25cm]
\pause
\textbf{Przykład:} \textit{Kwadrat ma nieskończenie wiele osi symetrii.}
\pause
\\[0.25cm] Są to tak zwane zdania proste - wyrażają one bowiem jedną myśl, składają się z jednego orzeczenia.
\pause \\[0.25cm] \textcolor{myAmber}{Pytanie:} Co się dzieje, gdy zdanie jest bardziej rozbudowane, skomplikowane? W jaki sposób wówczas z nim poradzić?
\end{frame}
\subsection{Zdania złożone}
\begin{frame}{Zdania złożone}
\justifying
Okazuje się, że zdania tej postaci:
\\[0.25cm] \pause \textit{Wojtek poszedł do kina lub zjawił się na stadionie.}
\\[0.25cm] \pause \textit{Eliza narysowała dom i wymieniła cieńkopis.}
\pause \\[0.25cm] prowadzą nas do nowego pojęcia: \textbf{zdania złożonego}. Powiedzmy coś o nich.
\end{frame}
To get more or less the same aspect ration than a A4 paper, you could modify the page geometry like this:
\documentclass[polish,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{polski}
\usepackage{ragged2e} %justify
%\usepackage[inline]{enumitem}
%\usepackage{multicol}
\usepackage{gensymb} %degree
%\usepackage{colortbl} %color of row
\usepackage{cancel} %fraction cancel line
%\usepackage{graphicx}
\usepackage{tikz}
%\usepackage{url} %bibliography
%\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{scalerel}
\usetheme{Warsaw}
\definecolor{myAmber}{rgb}{1.0, 0.49, 0.0} %#FF7E00
\usecolortheme[named=myAmber]{structure}
\title{Wprowadzenie do matematyki}
\subtitle{2. Koniunkcja i alternatywa w zdaniach.}
\author{Konstanty Dmochowski}
\makeatletter
\setlength\beamer#paperwidth{16.00cm} \setlength\beamer#paperheight{11.31cm}
\geometry{%
papersize={\beamer#paperwidth,\beamer#paperheight},
hmargin=2cm,%
vmargin=0cm,%
head=1cm,% might be changed later
headsep=0pt,%
foot=1cm% might be changed later
}
\makeatother
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\end{document}
Some other comments about your code:
don't use enumitem with beamer
beamer has its own column mechanism, multicol is not necessary
if you need something from the colortbl package, use the xcolor={table} documentclass option instead of loading the package
you don't need graphicx
you also don't need url - beamer loads hyperref
no need for amsmath either, beamer already loads this
using floating specifier such as [h!] in a documentclass without floating mechanism makes no sense
don't use \begin{center}...\end{center} within your figures. This adds additional vertical space and is also unnecessary because figures are centred by default
don't abuse \\ for line breaks. Leave an empty line instead
instead of manually numbering things like Definicja 1., use an appropriate environment like definition, these can be made to number things automatically
Just give the filename of images without file type. Latex will automatically choose the best suited type in case you have the image in different formats
have a look at the booktabs package. Data prison style tables are really ugly
it should be \justifying and not \justify (the later kinda works by accidents, but causes many strange problems because it actually is an environment and not a macro)