1

I have been making an assignment for my class in landscape form using long table. It is turning to be larger than the page, so I used the adjustwidth package to move the margins, but it only moves the long table on the last page as shown.

Page 1 Page 2

Here is the code

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

Sorry for the unindented code. I just want to know how to make the Table fit the page. Also could tell me how to put the circuits in another file and include them in the text. Thanks in advance.

7
  • 1
    see any latex tutorial, this is unrelated to longtable c columns are single line, you want at least the last column to have linebreaking so make it p{3cm} or whatever width you want. Commented Aug 11, 2017 at 12:47
  • 1
    never put longtable in a center environment` it doesn't centre it it just adds spurious vertical space Commented Aug 11, 2017 at 12:48
  • That stopped the table from going out of bounds but there is still that hideous space to its left. What can I do about that? Commented Aug 11, 2017 at 12:55
  • remove all these lines that are just breaking longtable and doing nothing useful! \begin{adjustwidth}{-1.5in}{-1.5in} \setlength\LTleft{1pt} \setlength\LTright{1pt} \setlength{\LTpre}{1pt} \setlength{\LTpost}{1pt} Commented Aug 11, 2017 at 12:59
  • And what is with the \extracolsep{\fill} if not to create a hideous space to the left? Commented Aug 11, 2017 at 13:00

2 Answers 2

1

Removing the settings that are forcing bad spacing and allowing linebreaking in the last column:

enter image description here

\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}
4
  • There is still some white space left. I want there to be nearly zero whitespace on both the sides Commented Aug 11, 2017 at 13:15
  • @PrateekDhanuka make the p column wider (if you make it much wider you get a warning that it is too wide) Commented Aug 11, 2017 at 13:18
  • It only moved to the Right. I want nearly no margin on both sides. It currently looks something like this - Amplifiers. Commented Aug 11, 2017 at 13:20
  • @PrateekDhanuka landscape rotates the text block without changing its size so the horizontal width is the previous textheight, leaving space for the page head and foot. If you want to over-print the page foot area set \LTleft to something negative say -2cm and then you can increase the width of the p column. (don't change \LTright) Commented Aug 11, 2017 at 13:49
1

Maybe it's something like this that you want, removing the white space at the top of cells with a \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} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .