我想包装一个图形,以便它位于段落的右侧,但是当我尝试编译它时,出现以下错误:
这是该部分的代码:
\documentclass[12pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{circuitikz}
\usepackage[margin=0.5in]{geometry}
\usepackage{multicol}
\usepackage{subcaption}
\usepackage{hyperref}
\usepackage{wrapfig}
\begin{document}
\subsection{Wheatstone Bridge}
\begin{wrapfigure}{r}{0.5\textwidth}
\includegraphics[width=0.5\linewidth]{Images/Wheatstonebridge.png}
\end{wrapfigure}
A wheatstone bridge is used to \textbf{measure an unknown resistance} value to a high degree of accuracy. It uses 4 resistors set up in a diamond fashion (shown below) and a voltmeter. In the schematic below, R$_x$ is the unknown resistance, R$_1$ and R$_3$ are fixed resistance values (generally the same, but they don't have to be the same, also generally $>$1\% tolerance, but again, not always) and R$_2$ is a variable resistor (potentiometer, this is not always the case, see below). By \textbf{adjusting R$_2$ until the voltmeter reads 0 volts}, you know that the \textbf{ratio between the $\frac{R_1}{R_2}$ and $\frac{R_3}{R_x}$ is equal}.\\
Without changing $R_2$:
\begin{align*}
V_G=\left(\frac{R_x}{R_3+R_x}-\frac{R_2}{R_1+R_2}\right)
\end{align*}
\end{document}
我尝试过改变\textwidth
和\linewidth
,但仍然不起作用。
答案1
正如我在评论中所说,我无法重现您的警告。使用以下 MWE,我做了三处小改动:
- 添加
siunitx
写入\SI{>1}{\%}
而不是$>$1\%
(与您的问题无关) - 移至
\usepackage{hyperref}
序言末尾(也与您的问题无关) - 我没有
\\
在第一段的末尾插入空行(我猜\\
不是这样的目的。如果你不喜欢有预期的段落,请将其添加到你的文档序言中\setlength\parindent{0pt}
)
通过这些小小的改变,我获得了一列文档的以下结果:
(一个与使用相关的警告circuitikz
,没有坏盒子)
对于两列文档:
(一个与使用有关的警告circuitikz
,一个与使用连字符调整段落中的单词有关的错误框unknown resistance
)
我在测试中使用的 MWE:
\documentclass[12pt,
twocolumn, %delete,if your article has only one column
demo]{extarticle}
%\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{circuitikz}
\usepackage[margin=0.5in]{geometry}
%\usepackage{multicol} % why you need it?
\usepackage{subcaption}
\usepackage{wrapfig}
\usepackage{siunitx} % new
\usepackage{lipsum} % for dummy text
\usepackage{hyperref} % had to be last in preamble
%\setlength\parindent{0pt}
\begin{document}
\subsection{Wheatstone Bridge}
\lipsum[66]
\begin{wrapfigure}[8]{r}{0.5\linewidth}
\vspace{-\baselineskip}
\includegraphics[width=\linewidth]{Images/Wheatstonebridge.png}
\end{wrapfigure}
A wheatstone bridge is used to \textbf{measure an unknown resistance} value to a high degree of accuracy. It uses 4 resistors set up in a diamond fashion (shown below) and a voltmeter. In the schematic below, R$_x$ is the unknown resistance, R$_1$ and R$_3$ are fixed resistance values (generally the same, but they don't have to be the same, also generally \SI{>1}{\%} tolerance, but again, not always) and R$_2$ is a variable resistor (potentiometer, this is not always the case, see below). By \textbf{adjusting R$_2$ until the voltmeter reads 0 volts}, you know that the \textbf{ratio between the $\frac{R_1}{R_2}$ and $\frac{R_3}{R_x}$ is equal}.
Without changing $R_2$:
\begin{align*}
V_G=\left(\frac{R_x}{R_3+R_x}-\frac{R_2}{R_1+R_2}\right)
\end{align*}
\lipsum[1-2]
\end{document}
结论,您的 MWE(如您的问题中所述)工作正常,没有任何错误、警告或坏框。正如@David Carlisle 在他的评论中提到的那样,如果您收到警告,您不必担心,它们只是警告,而不是错误。