Hello, I need to make a document in latex but it doesn't come out, I have this
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{circuitikz}
\usepackage{float}
\begin{document}
\begin{circuitikz}
\draw
node[american xor port]{} % Mejor con la pancita mas redonda no se como
;
\end{circuitikz}
\begin{tabular}{|l|l|l|}
\hline
X & Y & S \\
\hline
0 & 0 & 0 \\
\hline
0 & 1 & 1 \\
\hline
1 & 0 & 1 \\
\hline
1 & 1 & 0 \\
\hline
\end{tabular}
% I want the O with x inside
X Ox Y
\begin{tabular}{|l|l|l|l|l|}
\multicolumn{ 3}{l}{Input} & \multicolumn{ 2}{l}{Output} \\ \hline
X0 & X1 & X2 & A & B \\ \hline
0 & 0 & 0 & 0 & 0 \\ \hline
0 & 0 & 1 & 1 & 0 \\ \hline
0 & 1 & 0 & 0 & 1 \\ \hline
0 & 1 & 1 & 1 & 1 \\ \hline
1 & 0 & 0 & 0 & 0 \\ \hline
1 & 0 & 1 & 1 & 1 \\ \hline
1 & 1 & 0 & 1 & 1 \\ \hline
1 & 1 & 1 & 1 & 1 \\ \hline
\hline
\end{tabular}
\end{document}
This code is in latex and it gives me this
What I want is that the symbol of the xor the table and the formula are on the same line. Then below the table in the center and below the table these two photos
I don't understand why it separates everything into lines and doesn't put it straight and if someone can help me put the tables it would be better because I don't understand the tabulation thing well (I tried to do it in some ways but I get an error in texmaker) Thank you all anticipated
Several things:
In order for you to have everything on one line in the result, there must be no empty lines in the middle of things in the source, since an empty line for TeX means a "new paragraph".
If you want to separate things vertically in the source to have them better organized visually, instead of blank lines you can use "comment" lines (a simple
%
) which prevents TeX from taking it for a "new paragraph" mark.So that the logic gate is aligned towards the center of the table, you can put the option
[baseline]
The symbol for XOR is not an X in a circle, but a + in a circle. In LaTeX this is done with
$\oplus$
Photos are inserted with a
\includegraphics{}
. In order for both to appear on the same line, as stated above, there must be no blank lines between them in the source code. For the photos to come out of a suitable size you can use its option[width=]
to which you could pass a dimension in centimeters, but it may be more useful to pass it for example0.3\textwidth
, which means "a third of the width of the text line".To vertically separate things in the pdf a bit, you can use
\vskip
and pass how many centimeters or millimeters apart you want. It is also usual to use the one stored in the variable instead of putting a preset amount\baselineskip
, which contains the distance between lines used in that document.If you want to horizontally space things so they don't get too close together, you can use
\quad
or\qquad
(the second is a wider space than the first)To get everything centered horizontally, put everything in an environment
center
.Putting all this into practice, TeX would look like this:
And this is the resulting page:
Extension
The horizontal distance between the elements of the first line can be altered by putting more
\quad
or\qquad
between them. The vertical distance between page elements can be controlled with the\vskip
.Tables can be enhanced with the help of the
booktabs
. A general tip for making tables more beautiful is to avoid horizontal and vertical lines within them as much as possible. In your case, a vertical line may be necessary to separate inputs from outputs, but nothing more. And the only necessary horizontals are the ones that delimit the head of the table and its end, and not the ones between its rows.So for example the first table could be written as:
And the second like this:
It is required
\usepackage{booktabs}
in the preamble, and the result would be this:As for the Karnaugh diagram, you have the package
karnaugh-map
that is precisely to make those types of diagrams. However, electronics is not my specialty, so I do not fully understand all the options of the package. I think the following does what you're looking for:These are the resulting diagrams:
As a complement to abulafia's answer, I leave you an example of how to use the
karnaugh-map
.In the first case I include the terms manually with
\manualterms
, in the second usingminterms
andmaxterms
so you can see that there are several ways (see the documentation)