\documentclass[frontgrid,backgrid,a4paper,11pt]{flacards}
\usepackage{etoolbox}<br>
\pretocmd{\card}{\def\curhint{#1}}{}{}<br>
\pagesetup{2}{4}
\usepackage{xeCJK}<br>
% \usepackage[nofonts,\card{pt]{ctex}<br>
\setCJKmainfont{AR PL UKai CN}<br>
\setmainfont{Linux Libertine O}<br>
\renewcommand{\cardtextstylef}{\small}<br>
\renewcommand{\cardtextstyleb}{\small}<br>
\renewcommand{\frfoot}{}<br>
\renewcommand{\brfoot}{}<br>
% Temporarily disable new lines when displaying the riddle on the back<br>
\begin{document}<br>
\card{\begin{flushleft}<br>A particle of charge q enters a region of uniform magnetic field B(pointing into the page. The field deflects the particle a distance d above the original line of flight, as shown in Fig. Is the charge positive or negative? In terms of a, d, B, q, find the momentum of the particle.<br>\end{flushleft}\includegraphics[width=50mm]{p5,1.PNG}}{Problem 5.1}
\card{\begin{flushleft}In 1897, J.J. Thomson "discovered" the electron by measuring the charge-to-mass ratio of "cathode rays" (actually,streams of electrons, with charge q and mass m) as follows:\\ \\(a)First he passed the beam through uniform crossed electric and magnetic field $\vec{E}$ and $\vec{B}$ mutually perpendicular, and both of them perpendicular to the beam), and adjusted the electric field until he got zero deflection. What, then, was the speed of the particles (in terms of E and B)? \\ \\ (b) Then he turned off the electric field, and measured the radius of curvature, R, of the beam, as deflected by the magnetic field alone. In terms of E, B, and R, what is the charge-to-mass ratio (q/m) of the particles? \end{flushleft} }{Problem 5.3}
\card{\begin{flushleft}Suppose that the magnetic field in some region has the form$$B = kz\hat{x}$$(where k is a constant). Find the force on a square loop (side a), lying in the yz plane and centered at the origin, if it carries a current $I$, flowing counterclockwise, when you look down the x axis.\end{flushleft}}{Problem 5.4}
\card{\begin{flushleft}\end{flushleft}}{Problem 5.1}
\card{\begin{flushleft}\end{flushleft}}{Problem 5.1}
\card{\begin{flushleft}\end{flushleft}}{Problem 5.1}
\card{\begin{flushleft}\end{flushleft}}{Problem 5.1}
\card{\begin{flushleft}\end{flushleft}}{Problem 5.1}
\card{\begin{flushleft}\end{flushleft}}{Problem 5.1}
\card{\begin{flushleft}\end{flushleft}}{Problem 5.1}
\card{\begin{flushleft}\end{flushleft}}{Problem 5.1}
\card{\begin{flushleft}\end{flushleft}}{Problem 5.1}
\card{\begin{flushleft}\end{flushleft}}{Problem 5.1}
\card{\begin{flushleft}\end{flushleft}}{Problem 5.1}
\card{\begin{flushleft}\end{flushleft}}{Problem 5.1}
\end{document}
好的,这是我的代码。我收到错误,提示没有行结束。然后在简介和 a 之间以及 a 和 b 之间没有空行。我该如何修复这个问题?
编辑:我修复了这个问题,但不是针对 5.4,尽管 5.4 中没有换行符,但仍然会出现错误
答案1
文本中不允许出现重复\\
。有多种其他方法可以插入更大的垂直空间,例如\bigbreak
(参见长度及何时使用它们)。
此外,您不能\end{flushleft}
在参数末尾使用\card
。相反,您可以\raggedright
对每张卡片使用 ,这样内容将左对齐而不是居中。您还可以将其添加到卡片文本样式中,以自动设置所有卡片的左对齐。
在下面的代码中我将其替换$$
为\[ \]
(参见为什么 \[ ... \] 比 $$ ... $$ 更可取?)。
梅威瑟:
\documentclass[frontgrid,backgrid,a4paper,11pt]{flacards}
\usepackage{graphicx}
\pagesetup{2}{4}
\renewcommand{\cardtextstylef}{\small\raggedright}
\renewcommand{\cardtextstyleb}{\small}
\renewcommand{\frfoot}{}
\renewcommand{\brfoot}{}
\begin{document}
\card{%
A particle of charge q enters a region of uniform magnetic field B(pointing into the page. The field deflects the particle a distance d above the original line of flight, as shown in Fig. Is the charge positive or negative? In terms of a, d, B, q, find the momentum of the particle.%
\centering
\includegraphics[width=50mm]{example-image}%
}{Problem 5.1}
\card{In 1897, J.J. Thomson "discovered" the electron by measuring the charge-to-mass ratio of "cathode rays" (actually,streams of electrons, with charge q and mass m) as follows:\bigbreak (a) First he passed the beam through uniform crossed electric and magnetic field $\vec{E}$ and $\vec{B}$ mutually perpendicular, and both of them perpendicular to the beam), and adjusted the electric field until he got zero deflection. What, then, was the speed of the particles (in terms of E and B)?\\ (b) Then he turned off the electric field, and measured the radius of curvature, R, of the beam, as deflected by the magnetic field alone. In terms of E, B, and R, what is the charge-to-mass ratio (q/m) of the particles?}{Problem 5.3}
\card{Suppose that the magnetic field in some region has the form \[B = kz\hat{x}\] (where k is a constant). Find the force on a square loop (side a), lying in the yz plane and centered at the origin, if it carries a current $I$, flowing counterclockwise, when you look down the x axis.}{Problem 5.4}
\end{document}
结果: