我一直在为我的班级布置一个横向的作业,使用长表格。它变得比页面大,所以我使用adjustwidth包来移动边距,但它只移动最后一页的长表格,如图所示。
以下是代码
\documentclass[a4paper]{article}
\usepackage{tikz,caption,chngpage,pdflscape,amsmath,circuitikz,longtable,lipsum}
\usetikzlibrary{circuits.logic.US,circuits.logic.IEC,fit}
\newcommand\addvmargin[1]{
\node[fit=(current bounding box),inner ysep=#1,inner xsep=0]{};
}
\begin{document}
\pagenumbering{gobble}
\begin{landscape}
\begin{center}
\begin{adjustwidth}{-1.5in}{-1.5in}
\setlength\LTleft{1pt}
\setlength\LTright{1pt}
\setlength{\LTpre}{1pt}
\setlength{\LTpost}{1pt}
\begin{longtable}{@{\extracolsep{\fill}}c|c|c|c|c@{}}
%\caption{Different Amplifiers}
\setlength{\tabcolsep}{5mm}
\def\arraystretch{1.25}
S.No. & Configuration & Circuit Diagram & Output Equation & Applications
\\ \hline
1 & Differential Amplifier &
\begin{tikzpicture} [transform shape,baseline=0,scale=0.75] \draw
(0,0) node[op amp] (opamp) {$A$}
(opamp.-) node[left] {} to [open,v<=$v_{id}$]
(opamp.+) node[left] {}
(opamp.out) node[right] {}
(opamp.up) --++ (0,0.5) node[vcc] {$+V_{cc}$}
(opamp.down) --++ (0,-0.5) node[vee] {$-V_{ee}$}
(opamp.-) to [short] ++(-2.5,0) to [short] ++(0,-1) to [R=$R_{in_2}$]
++(0,-2) to [sV=$V_{in_2}$] ++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.+) to [short] ++(-0.5,0) to [R=$R_{in_1}$]
++(0,-2) to [sV=$V_{in_1}$] ++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.out) --++(1,0) --++(0,-1) to [R=$R_l$]
++(0,-2.5) to node[ground] {} ++(0,-0.5)
(opamp.out) --++(1,0) to[short,-o] ++(0.5,0) node[]{} node[right]{$v_{out}$}
;
\addvmargin{1mm}
\end{tikzpicture} & $\begin{aligned}[t]
v_{out}&=A*(v_{id})\\ v_{id}&= v_+ - v_-
\end{aligned}$ & \lipsum[1]\\
\hline
2 & Inverting Amplifier &
\begin{tikzpicture} [transform shape,baseline=0,scale=0.75] \draw
(0,0) node[op amp] (opamp) {$A$}
(opamp.up) --++ (0,0.5) node[vcc] {$+V_{cc}$}
(opamp.down) --++ (0,-0.5) node[vee] {$-V_{ee}$}
(opamp.-) --++(-2.5,0) --++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.+) --++(-0.5,0) to [R=$R_{in}$]
++(0,-2) to [sV=$V_{in}$] ++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.out) --++(1,0) --++(0,-1) to [R=$R_l$]
++(0,-2.5) to node[ground] {} ++(0,-0.5)
(opamp.out) to[open] ++(1,0) to[short,-o] ++(0.5,0) node[]{} node[right]{$v_{out}$}
;
\end{tikzpicture} &$v_{out} \approx -A*v_{in}$ & \lipsum[1] \\ \hline
3 & Non-Inverting Amplifier &
\begin{tikzpicture} [transform shape,baseline=0,scale=0.75] \draw
(0,0) node[op amp] (opamp) {$A$}
(opamp.up) --++ (0,0.5) node[vcc] {$+V_{cc}$}
(opamp.down) --++ (0,-0.5) node[vee] {$-V_{ee}$}
(opamp.+) --++(-0.5,0) --++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.-) --++(-2.5,0) to [R=$R_{in}$]
++(0,-2) to [sV=$V_{in}$] ++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.out) --++(1,0) --++(0,-0.5) to [R=$R_l$]
++(0,-1.5) to node[ground] {} ++(0,-0.5)
(opamp.out) to[open] ++(1,0) to[short,-o] ++(0.5,0) node[]{} node[right]{$v_{out}$}
;
\end{tikzpicture} & $v_{out} \approx A*v_{in}$ & \lipsum[1] \\
\end{longtable}
\end{adjustwidth}
\end{center}
\end{landscape}
\end{document}
抱歉代码没有缩进。我只想知道如何让表格适合页面。也可以告诉我如何将电路放入另一个文件并将它们包含在文本中。提前致谢。
答案1
删除强制使用错误间距并允许在最后一列换行的设置:
\documentclass[a4paper]{article}
\usepackage{tikz,caption,chngpage,pdflscape,amsmath,circuitikz,longtable,
lipsum,array}
\usetikzlibrary{circuits.logic.US,circuits.logic.IEC,fit}
\newcommand\addvmargin[1]{
\node[fit=(current bounding box),inner ysep=#1,inner xsep=0]{};
}
\begin{document}
\pagenumbering{gobble}
\begin{landscape}
%if you want these they need to be here not inside the table
%% \setlength{\tabcolsep}{5mm}
%% \def\arraystretch{1.25}
\begin{longtable}{@{}c|c|c|c|>{\raggedright\arraybackslash}p{6.2cm}@{}}
%\caption{Different Amplifiers}
S.No. & Configuration & Circuit Diagram & Output Equation & Applications
\\ \hline
1 & Differential Amplifier &
\begin{tikzpicture} [transform shape,baseline=0,scale=0.75] \draw
(0,0) node[op amp] (opamp) {$A$}
(opamp.-) node[left] {} to [open,v<=$v_{id}$]
(opamp.+) node[left] {}
(opamp.out) node[right] {}
(opamp.up) --++ (0,0.5) node[vcc] {$+V_{cc}$}
(opamp.down) --++ (0,-0.5) node[vee] {$-V_{ee}$}
(opamp.-) to [short] ++(-2.5,0) to [short] ++(0,-1) to [R=$R_{in_2}$]
++(0,-2) to [sV=$V_{in_2}$] ++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.+) to [short] ++(-0.5,0) to [R=$R_{in_1}$]
++(0,-2) to [sV=$V_{in_1}$] ++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.out) --++(1,0) --++(0,-1) to [R=$R_l$]
++(0,-2.5) to node[ground] {} ++(0,-0.5)
(opamp.out) --++(1,0) to[short,-o] ++(0.5,0) node[]{} node[right]{$v_{out}$}
;
\addvmargin{1mm}
\end{tikzpicture} & $\begin{aligned}[t]
v_{out}&=A*(v_{id})\\ v_{id}&= v_+ - v_-
\end{aligned}$ & \lipsum[1]\\
\hline
2 & Inverting Amplifier &
\begin{tikzpicture} [transform shape,baseline=0,scale=0.75] \draw
(0,0) node[op amp] (opamp) {$A$}
(opamp.up) --++ (0,0.5) node[vcc] {$+V_{cc}$}
(opamp.down) --++ (0,-0.5) node[vee] {$-V_{ee}$}
(opamp.-) --++(-2.5,0) --++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.+) --++(-0.5,0) to [R=$R_{in}$]
++(0,-2) to [sV=$V_{in}$] ++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.out) --++(1,0) --++(0,-1) to [R=$R_l$]
++(0,-2.5) to node[ground] {} ++(0,-0.5)
(opamp.out) to[open] ++(1,0) to[short,-o] ++(0.5,0) node[]{} node[right]{$v_{out}$}
;
\end{tikzpicture} &$v_{out} \approx -A*v_{in}$ & \lipsum[1] \\ \hline
3 & Non-Inverting Amplifier &
\begin{tikzpicture} [transform shape,baseline=0,scale=0.75] \draw
(0,0) node[op amp] (opamp) {$A$}
(opamp.up) --++ (0,0.5) node[vcc] {$+V_{cc}$}
(opamp.down) --++ (0,-0.5) node[vee] {$-V_{ee}$}
(opamp.+) --++(-0.5,0) --++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.-) --++(-2.5,0) to [R=$R_{in}$]
++(0,-2) to [sV=$V_{in}$] ++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.out) --++(1,0) --++(0,-0.5) to [R=$R_l$]
++(0,-1.5) to node[ground] {} ++(0,-0.5)
(opamp.out) to[open] ++(1,0) to[short,-o] ++(0.5,0) node[]{} node[right]{$v_{out}$}
;
\end{tikzpicture} & $v_{out} \approx A*v_{in}$ & \lipsum[1] \\
\end{longtable}
\end{landscape}
\end{document}
答案2
\raisebox
也许您想要的是类似这样的东西,使用?删除单元格顶部的空白区域。
\documentclass[a4paper]{article}
\usepackage{tikz, caption, changepage, pdflscape, array, amsmath, circuitikz, longtable, lipsum}
\usetikzlibrary{circuits.logic.US,circuits.logic.IEC,fit}
\newcommand\addvmargin[1]{
\node[fit=(current bounding box),inner ysep=#1,inner xsep=0]{};
}
\begin{document}
\pagenumbering{gobble}
\begin{landscape}
\begin{center}\setlength\extrarowheight{3pt}
\begin{adjustwidth}{-1.5in}{-1.5in}
\setlength\LTleft{1pt}
\setlength\LTright{1pt}
\setlength{\LTpre}{1pt}
\setlength{\LTpost}{1pt}
\begin{longtable}{c|c|c|c| >{\arraybackslash}p{6.5cm}@{}}
%\caption{Different Amplifiers}
%\setlength{\tabcolsep}{5mm}
%\def\arraystretch{1.25}
S.No. & Configuration & Circuit Diagram & Output Equation & Applications
\\ \hline
1 & Differential Amplifier &
\raisebox{\dimexpr2ex-\height}{\begin{tikzpicture} [transform shape,baseline=0,scale=0.75] \draw
(0,0) node[op amp] (opamp) {$A$}
(opamp.-) node[left] {} to [open,v<=$v_\mathrm{id}$]
(opamp.+) node[left] {}
(opamp.out) node[right] {}
(opamp.up) --++ (0,0.5) node[vcc] {$+V_{cc}$}
(opamp.down) --++ (0,-0.5) node[vee] {$-V_{ee}$}
(opamp.-) to [short] ++(-2.5,0) to [short] ++(0,-1) to [R=$R_\mathrm{in_2}$]
++(0,-2) to [sV=$V_\mathrm{in_2}$] ++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.+) to [short] ++(-0.5,0) to [R=$R_\mathrm{in_1}$]
++(0,-2) to [sV=$V_\mathrm{in_1}$] ++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.out) --++(1,0) --++(0,-1) to [R=$R_l$]
++(0,-2.5) to node[ground] {} ++(0,-0.5)
(opamp.out) --++(1,0) to[short,-o] ++(0.5,0) node[]{} node[right]{$v_\text{out}$}
;
\end{tikzpicture}} & $\begin{aligned}[t]
v_\text{out}&=A*(v_\text{id})\\ v_\text{id}&= v_+ - v_-
\end{aligned}$ & \lipsum[1]%
\\
\hline
2 & Inverting Amplifier &
\raisebox{\dimexpr2ex-\height}{ \begin{tikzpicture} [transform shape,baseline=0,scale=0.75] \draw
(0,0) node[op amp] (opamp) {$A$}
(opamp.up) --++ (0,0.5) node[vcc] {$+V_{cc}$}
(opamp.down) --++ (0,-0.5) node[vee] {$-V_{ee}$}
(opamp.-) --++(-2.5,0) --++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.+) --++(-0.5,0) to [R=$R_{in}$]
++(0,-2) to [sV=$V_text{in}$] ++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.out) --++(1,0) --++(0,-1) to [R=$R_l$]
++(0,-2.5) to node[ground] {} ++(0,-0.5)
(opamp.out) to[open] ++(1,0) to[short,-o] ++(0.5,0) node[]{} node[right]{$v_text{out}$}
;
\end{tikzpicture}} &$v_\text{out} \approx -A*v_\text{in}$ & \lipsum[1]%
\\ \hline
3 & Non-Inverting Amplifier &
\raisebox{\dimexpr2ex-\height}{\begin{tikzpicture} [transform shape,baseline=0,scale=0.75] \draw
(0,0) node[op amp] (opamp) {$A$}
(opamp.up) --++ (0,0.5) node[vcc] {$+V_{cc}$}
(opamp.down) --++ (0,-0.5) node[vee] {$-V_{ee}$}
(opamp.+) --++(-0.5,0) --++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.-) --++(-2.5,0) to [R=$R_{in}$]
++(0,-2) to [sV=$V_\text{in}$] ++(0,-1) to node[ground] {} ++(0,-0.5)
(opamp.out) --++(1,0) --++(0,-0.5) to [R=$R_l$]
++(0,-1.5) to node[ground] {} ++(0,-0.5)
(opamp.out) to[open] ++(1,0) to[short,-o] ++(0.5,0) node[]{} node[right]{$v_\text{out}$}
;
\end{tikzpicture}} & $v_\text{out} \approx A*v_\text{in}$ & \lipsum[1]%
\end{longtable}
\end{adjustwidth}
\end{center}
\end{landscape}
\end{document}