在 WinEdt 中编译包含数学内容的文档后,保持打开状态,切换到另一个任务(例如打开浏览器并查看 tex.stackexchange.com 网站),然后当我返回时,我得到了如下图所示的文档数学内容。当我关闭并打开文档时,情况也一样。问题是什么?
相应代码生成的输出是:
笔记
编译没有问题。但是下次查看时我无法理解我写了什么代码。
这是我的源代码:
主文件:
\documentclass[12pt, a4paper]{book}
\usepackage{setspace}
\usepackage[many]{tcolorbox}
\usepackage[detect-all]{siunitx}
\DeclareSIUnit\gauss{G}
\usepackage[pagestyles]{titlesec}
\usepackage{amsmath}
%\usepackage{empheq}
%%--------tcolorbox setting for the SI Units display---------%%
\newtcolorbox{siunit}{enhanced,
colframe=red!60!black,colback=yellow!50!white,arc=4pt,boxrule=1pt,
drop fuzzy shadow,before=\begin{center},after=\end{center},hbox}
%\tcbset{highlight math style={enhanced,
% colframe=red!60!black,colback=yellow!50!white,arc=4pt,boxrule=1pt,
% drop fuzzy shadow}}
\newtcbox{\picturebox}[1][]{nobeforeafter,math upper,tcbox raise base,
enhanced,watermark graphics=example-grid-100x100bp.jpg,% from package mwe
colback=white,frame hidden,boxrule=0pt,arc=10pt,
watermark stretch=1.00,watermark opacity=0.4,#1}
%%--------Chapter and Section headings display------------%%
\makeatletter
\renewcommand{\thechapter}{\Roman{chapter}}
\titleformat{\chapter}[display]
{\bfseries\LARGE\filleft} %\centering doesn't work only \filleft
{\filleft\MakeUppercase{\chaptertitlename} \Huge\thechapter}
{4ex}
{\titlerule
\vspace{2ex}%
\filright}
[\vspace{2ex}
\titlerule]
\renewcommand{\thesection}{\Roman{section}}
\titleformat{\section}
{\Large\bfseries}
{}{1em}{}
\titlespacing{\section}
{-2.15pc}{3.5ex plus .1ex minus .2ex}{1.5ex minus .1ex}
\titlespacing*{\paragraph} {0pt}{3.25ex plus 1ex minus .2ex}{0.35em}
\makeatletter
\newpagestyle{mystyle}{
\headrule \sethead[\thepage][][\chaptertitlename\ \thechapter. \chaptertitle]
{\sectiontitle}{}{\thepage}}
\begin{document}
\pagestyle{mystyle}
\frontmatter
\begin{titlepage}
\end{titlepage}
\mainmatter
\include{magnetic}
\end{document}
磁性.tex:
\chapter{Magnetic Materials}
\section{Introduction}
Magnetic materials have had various applications in ancient and modern society. A magnetic compass made of lodestone (magnetite) was used for navigation since the north pole of a compass point toward the south pole of Earth's magnetic field. In the modern era, magnetism and magnetic materials find applications in various fields.
\section{Origin of Magnetic properties of materials}
Magnetic properties of materials have their origin in :
\begin{enumerate}
\item Permanent magnetic moments of their atoms and$/$or
\item Induced magnetic moments due to the change of motion of the electric charges of the atoms in an external magnetic field.
\end{enumerate}
The magnetic moments of atomic nuclei are generally neglected as they are very small.
\paragraph{Permanent magnetic moment of atoms}is due to the orbital and spin motions of unpaired electrons (i.e., electrons in the incompletely filled valence shell). Electrons in completely filled valence shells have no magnetic moment.(Eg. He, Ne, Ar etc). Some of the important terms in the study of magnetic materials is given below.
\paragraph{Magnetic fields}are generated by movement of electric charges. \textit{\bfseries Magnetic field} is the region of space where moving charges, current carrying elements or other magnetic objects will experience a force.
\paragraph{Magnetic moment}of a magnet is a quantity that determines the force the magnet can exert on electric currents and the torque that a magnetic field will exert on it. A loop of electric current generates a \textit{magnetic dipole field}. \textit{Magnitude} of the magnetic dipole moment is the product of the current and the area of the loop. Magnetic dipole is often represented schematically as an arrow. The head of the arrow is the North pole.\par
\begin{siunit}
SI unit : Ampere. square metre (\si{\ampere\square\meter})
\end{siunit}
\paragraph{Magnetic Field lines} run from the North pole to the South pole.
\paragraph{Magnetic Flux}The group of magnetic field lines emitted outward from the north pole of a magnet is called \textit{magnetic flux}.\par
\begin{siunit}
SI~unit : Weber (\si{\weber})
\end{siunit}
One weber is equal to $1$ x $10⁸$ magnetic field lines. Direction of flux at any point in space indicates the direction of force that would be experienced by a North pole placed at that point.
\paragraph{Intensity of Magnetization M}A Material with a net (nonzero) magnetic moment is magnetized. \textit{Intensity of Magnetization M} is the magnetic moment per unit volume within the material.\par
\begin{siunit}
SI unit : Ampere per metre (\si{\ampere\per\meter})
\end{siunit}
M depends on the following:
\begin{enumerate}
\item Number density of magnetic dipole moments within material.
\item Magnitude of the magnetic dipole moments.
\item The arrangement of the magnetic dipoles within the material and so on.
\end{enumerate}
\paragraph{Magnetization M}in materials mainly arises from spins of unpaired electrons within the material and to a lesser extent from their orbital motion.
\section{Magnetic field}
A \textbf{magnetic field} is a field of force produced by moving electric charges, by electric fields varying with time and by the \textbf{intrinsic} magnetic field of elementary particles due to their spin. Magnetic field is a vector field and is most commonly defined in terms of the Lorentz force that it exerts on moving electric charges. The magnetic field can be visualized as magnetic field lines.\par
There are two separate but closely related fields to which the name 'magnetic field' can refer:
A magnetic \textbf{B} field called \textit{magnetic induction} or \textit{magnetic flux density} \par
%{\centering \tcbox{SI unit : tesla, T}} %%tcolorbox not properly aligned when using \centering -- thought will complete in a single line
\begin{siunit}
SI unit : tesla, \si{\tesla}
\end{siunit}
and a magnetic \textbf{H} field called \textit{magetic field strength} or \textit{magnetizing field}\par
%{\centering \tcbox{SI unit : Ampere per metre $A.m⁻¹$}}
\begin{siunit}
SI unit : Ampere per metre (\si{\ampere\per\meter})
\end{siunit}
Magnetic field strength \textbf{H} is measured in \si{\ampere\per\meter}, and magnetic flux density \textbf{B}, measured in \si{\newton\meter\per\ampere}, also called tesla (\si{\tesla}).
\paragraph{Magnetic flux density or magnetic induction B}\textit{Magnetic Flux density} \textbf{B} is the amount of magnetism induced in a body and it is a function of the \textit{magnetizing force} \textbf{H}.
The \textit{magnetic induction}, \textbf{B} is defined as the amount of magnetic flux through a unit area taken perpendicular to the direction of the magnetic flux.
\begin{siunit}
\begin{minipage}{0.75\linewidth}
SI unit : Weber per metre square (\si{\weber\per\square\meter}) or tesla (\si{\tesla})
\par
CGS unit : gauss ($\SI{1}{\tesla} = \SI{10000}{\gauss}$)
\end{minipage}
\end{siunit}
\paragraph{Manetic field strength, H}Magnetic field strength \textbf{H} is the amount of magnetizing force. Magnetic field strength is a vector quantity whose magnitude is the strength of a magnetic field at a point in the direction of the magnetic field at that point.
\begin{siunit}
SI~unit : Ampere~per~metre (\si{\ampere\per\meter})
\end{siunit}
\section{Relation between B and H}
\textit{In free space or outside of a material (i.e., in vacuum) the \textbf{B} and \textbf{H} fields are indistinguishable (they only differ by a multiplicative constant).}
\begin{gather*}
B = \mu_{0}.H \quad \text{(in vaccum)} \\
\mu_{0} → \text{magnetic permeability of free space (vacuum)}
\end{gather*}
where $\mu_{0} = 4\pi~\text{x}~10⁷ N.A⁻²~(H.m⁻¹)$ \par
Inside magnetic material, $B = \mu.H = \mu_{0}.H + \mu_{0}.M $ where $\mu$ is the \\ \textit{magnetic permeability of medium}.
\paragraph{Magnetic Permeability $\mu$}refers to the degree of magnetization of a material in response to an applied magnetic field.
\begin{siunit}
SI~unit : Newton~per~square~Ampere (\si{\newton\per\square\ampere})
\end{siunit}
The relation between $\mu$ and $\mu₀$ is given by $μ= \mu₀.\mu_r$ where $\mu_r$ is the relative permeability of the medium. $\mu_r = 1$ for free space (vacuum) and $\mu_r > 1$ for magnetic materials. The larger the value of $\mu_r$, the larger will be the degree of magnetization of the material in an external magnetic field.\par
Unlike \textbf{B}, magnetization \textbf{M} only exists inside a magnetic material. \\Therefore, field lines of \textbf{M} begin and end near magnetic poles.\par
Magnetic flux density \textbf{B} inside a magnetic material with intensity of magnetization \textbf{M} is given by
\begin{align}
B &= \mu.H \notag \\
B &= \mu₀.H + \mu₀.M
\intertext{As $μ= \mu₀.\mu_r$,}
B &= \mu₀.\mu_r.H \notag \\
B &= \mu₀(H + M) \label{eq:2}
\end{align}
Using equation~\eqref{eq:2}, it is obtained that $χ= (M/H) = \mu_r-1$
注意在第二个文件中,字符是如何变化的,例如(\mu
和\chi
)
我正在使用 WinEdt 8 和 Windows 7 专业版
答案1
在您的 WinEdt 中,您必须自定义并启用翻译表(否则其他人会在您不知情的情况下在您的程序副本中这样做)。默认情况下,它们未启用,并且不会翻译任何希腊字符,如\mu
或\chi
。
您可能没有意识到,但 winedt.org 上的一些软件包引入了翻译表,从而实现了上述“功能”。例如,MathGreek
软件包安装读取和写入翻译表,其中包括将希腊符号转换为其 Unicode 等价符号,反之亦然。
在 WinEdt 中你会看到:
\begin{align}
B &= \mu.H \notag \\
B &= \mu₀.H + \mu₀.M
\intertext{As $μ= \mu₀.\mu_r$,}
B &= \mu₀.\mu_r.H \notag \\
B &= \mu₀(H + M) \label{eq:2}
\end{align}
Using equation~\eqref{eq:2}, it is obtained that $χ= (M/H) = \mu_r-1$
在记事本中打开同一个文件,您会看到之前输入的“正确”源代码:
begin{align}
B &= \mu.H \notag \\
B &= \mu_0.H + \mu_0.M
\intertext{As $\mu = \mu_0.\mu_r$,}
B &= \mu_0.\mu_r.H \notag \\
B &= \mu_0(H + M) \label{eq:2}
\end{align}
Using equation~\eqref{eq:2}, it is obtained that $\chi = (M/H) = \mu_r-1$
解决方案:保存所有文档,启动选项界面(选项菜单)并双击翻译表。您可能会发现类似以下内容:
TABLE="TeX_Read"
TYPE=1
INVERTED=0
ENABLED=1
MODE_FILTER="TeX"
SUB="END_LIST"
"!`" -> "¡"
"?`" -> "¿"
...
"\mu " -> "μ"
"\chi " -> "χ"
"_0" -> "₀"
etc...
以及 的逆转换TABLE="TeX_Write"
。禁用两个(!!!) 表 ( ENABLED=0
),重新加载修改后的脚本,然后重新启动 WinEdt。
默认情况下,这些表未启用,并且没有\mu
或 的\chi
条目。它们必须由您启用并修改。有些用户可能会认为这是一个功能。由于读取和写入转换表相互抵消,这只会影响 WinEdt 显示文本的方式,而不会影响文件保存和 TeX 查看的方式:这就是您在编译时没有问题的原因。读取和写入转换表最初用于处理 TeX 符号中的国际字符(例如\^{A}
->Â
表示读取,Â
->\^{A}
表示写入)。