2
\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}  



ok this is my code. I get the error that there is no line to end. and then i do not get an empty line between the intro and a, and between a and b. how do i fix this?

Edit: I fixed it only not for 5.4 which still gives an error even though there are no line break in 5.4

  • Welcome to TeX.SX. Have you considered reading an introduction to LaTeX? You cannot use double backslashes to add empty lines in the output. – Johannes_B Mar 29 '19 at 05:43
  • welcome to tex.se! that we can help you and understand what is your problem, please extend your code fragment to complete small document beginning with \documentclass{...} and ending with \end{document}. – Zarko Mar 29 '19 at 05:43
  • i also get the error for my 5.4 question while i dont have any linebreaks in there so the document is fine i just get the error. – Danielvanheuven Mar 29 '19 at 06:01

1 Answers1

2

It is not allowed to have a double \\ in the text. There are various other ways to insert a larger vertical space, for example \bigbreak (see Lengths and when to use them).

Furthermore, you cannot use \end{flushleft} at the end of the argument to \card. Instead you can use \raggedright for each card so the contents will be left justified instead of centered. You can also add that to the card text style to automatically set the left alignment for all cards.

In the code below I have replaced $$ with \[ \] (see Why is \[ ... \] preferable to $$ ... $$?).

MWE:

\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}

Result:

enter image description here

Marijn
  • 37,699