![投影仪与 subfig 斗争(subfig 不起作用!)](https://linux22.com/image/255093/%E6%8A%95%E5%BD%B1%E4%BB%AA%E4%B8%8E%20subfig%20%E6%96%97%E4%BA%89%EF%BC%88subfig%20%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8%EF%BC%81%EF%BC%89.png)
我想在一个框架中放置多个图形。我尝试了不同的组合,但都不起作用。我使用了subfigure
(有效)但我无法以正确的方式放置这些图形。
正如我所读,它更好用subfig
(并且对我来说也更容易),但它似乎subfig
总是引发很多错误(并且它会打开文件subfig.sty
)。
\documentclass[10pt,blue]{beamer}
\setbeamertemplate{navigation symbols}{}
\usepackage[caption=false]{subfig}
\usepackage{fontspec}
\setsansfont{DejaVuSans}
\usepackage{polyglossia}
\setmainlanguage{greek}
\setotherlanguage{english}
\usepackage{url}
%\usepackage{caption}%,subcaption}
\usepackage{ graphicx, amsmath, amssymb, lettrine}
\newcommand{\EN}[1]{\foreignlanguage{english}{#1}}
\mode<presentation>
\begin{document}
\begin{frame}
\frametitle{\EN{title}}
\setbeamercovered{transparent}
\begin{figure}
\centering
\subfloat[][]{\includegraphics[scale=0.55]{cad-}\label{lab1}}
\subfloat[][]{\includegraphics[scale=0.55]{grid}\label{lab2}}
\subfloat[][]{\includegraphics[scale=0.55]{grid}\label{lab3}}
\subfloat[][]{\includegraphics[scale=0.55]{grid}\label{lab4}}
\subfloat[][]{\includegraphics[scale=0.55]{grid}\label{lab5}}
\subfloat[][]{\includegraphics[scale=0.55]{grid}\label{lab6}}
%\caption{\EN{text} \protect\subref{lab1} \EN{some text}
% \protect\subref{lab2} \EN{ text}}
\end{figure}
\end{frame}
\end{document}
- - - - - - - -更新 - - - - - - - - - - - - - - - - -
即使这样设置也不起作用。似乎subfig
不起作用。它打开了subfig.sty
文件。
\documentclass{beamer}
\usepackage[utf8x]{inputenc}
\usepackage{default}
\usepackage[caption=false]{subfig}
\begin{document}
Hello
\end{document}
---------------更新 2-----------------------
文件开头log
:
This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009/Debian) (format=xelatex 2012.7.6) 9 SEP 2012 17:49
entering extended mode
%&-line parsing enabled.
**forstack.tex
(./forstack.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, ibycus, monogreek, greek, ancientgreek, loaded.
(/usr/share/texmf-texlive/tex/latex/graphics/graphicx.sty
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks14
)
(/usr/share/texmf-texlive/tex/latex/graphics/graphics.sty
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
(/usr/share/texmf-texlive/tex/latex/graphics/trig.sty
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
(/etc/texmf/tex/latex/config/graphics.cfg
File: graphics.cfg 2009/08/28 v1.8 graphics configuration of TeX Live
)
Package graphics Info: Driver file: xetex.def on input line 91.
(/usr/share/texmf-texlive/tex/xelatex/xetex-def/xetex.def
File: xetex.def 2009/11/22 v0.94 LaTeX color/graphics driver for XeTeX (RRM/JK)
))
\Gin@req@height=\dimen102
\Gin@req@width=\dimen103
)
(/usr/share/texmf/tex/latex/beamer/base/beamer.cls
(/usr/share/texmf/tex/latex/beamer/base/beamerbasercs.sty
Package: beamerbasercs 2007/01/28 (rcs-revision 1.4)
)
Document Class: beamer 2007/03/11 cvs version 3.07 A class for typesetting pres
entations (rcs-revision 1.70)
(/usr/share/texmf/tex/latex/beamer/base/beamerbasemodes.sty
第一个错误:
! Missing \endcsname inserted.
<to be read again>
\ext@figure
l.298 ...ined{c@subfigure}{\newsubfloat{figure}}{}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.298 ...ined{c@subfigure}{\newsubfloat{figure}}{}
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! Extra \endcsname.
\@ifundefined ...dafter \ifx \csname #1\endcsname
\relax \expandafter \@firs...
l.298 ...ined{c@subfigure}{\newsubfloat{figure}}{}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\ext@figure
l.298 ...ined{c@subfigure}{\newsubfloat{figure}}{}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Extra \endcsname.
\newcounter ...ifdefinable \csname c@#1\endcsname
{\@definecounter {#1}}\@if...
l.298 ...ined{c@subfigure}{\newsubfloat{figure}}{}
I'm ignoring this, since I wasn't doing a \csname.
答案1
以下修改后的 MWE 形式 (i) 不会引发任何错误,并且 (ii) 能够将所有六个“图形”并排放置。由于我无法访问文件cad-[.pdf]
和grid[.pdf]
,请注意,我必须graphicx
使用选项集加载包demo
(这将仅创建一个黑色斑点,而不是加载实际的图形文件)。
此外,由于我不知道您的图形文件的自然比例是多少,我已将所有[scale=0.55]
指令替换为[width=1.4cm]
指令。我还插入了各种\hspace{1mm}
指令以在子浮点之间创建一些分隔。
\RequirePackage[demo]{graphicx} % remove this in final version
\documentclass[10pt,blue]{beamer}
\setbeamertemplate{navigation symbols}{}
\usepackage[caption=false]{subfig}
\usepackage{fontspec}
\setsansfont{DejaVuSans}
\usepackage{polyglossia}
\setmainlanguage{greek}
\setotherlanguage{english}
\usepackage{url}
%\usepackage{caption}%,subcaption}
\usepackage{ amsmath, amssymb, lettrine} % don't load graphicx package again -- beamer already does that
\newcommand{\EN}[1]{\foreignlanguage{english}{#1}}
\mode<presentation>
\begin{document}
\begin{frame}
\frametitle{\EN{title}}
\setbeamercovered{transparent}
\begin{figure}
\centering
\subfloat[][]{\includegraphics[width=1.4cm]{cad-}\label{lab1}}
\hspace{1mm}
\subfloat[][]{\includegraphics[width=1.4cm]{grid}\label{lab2}}
\hspace{1mm}
\subfloat[][]{\includegraphics[width=1.4cm]{grid}\label{lab3}}
\hspace{1mm}
\subfloat[][]{\includegraphics[width=1.4cm]{grid}\label{lab4}}
\hspace{1mm}
\subfloat[][]{\includegraphics[width=1.4cm]{grid}\label{lab5}}
\hspace{1mm}
\subfloat[][]{\includegraphics[width=1.4cm]{grid}\label{lab6}}
%\caption{\EN{text} \protect\subref{lab1} \EN{some text}
% \protect\subref{lab2} \EN{ text}}
\end{figure}
\end{frame}
\end{document}