I am doing a scrape from the web "fotocasa" in Spain.
I download the item that contains the price doing the following:
url<-"https://www.fotocasa.es/es/comprar/casas/madrid-provincia/todas-las-zonas/l/3?latitude=40.415&longitude=-3.7104&combinedLocationIds=724,14,28,0,0,0,0,0,0"
idealista <- html(url)
price<-idealista %>%
html_nodes("span") %>% #item de precios
html_text()
And I have a vector similar to this:
>price
...
[97] "hace 1 hora" "198.500€"
[99] "198.500€" "€"
[101] "4 habs." "128 m²"
[103] "" ""
[105] "" ""
[107] "" "hace 1 hora"
[109] "6.000.000€" "6.000.000€"
[111] "€" "5 habs."
[113] "641 m²" ""
[115] "" ""
[117] "" ""
[119] "hace 1 hora" "1.800.000€"
[121] "1.800.000€" "€"
[123] "Ha bajado 100.000€" "5 habs."
[125] "800 m²" ""
[127] "" ""
[129] "" ""
[131] "hace 1 hora" "690.000€"
[133] "690.000€" "€"
[135] "Ha bajado 410.000€" "3 habs."
[137] "320 m²" ""
[139] "" ""
...
I want only the values that contains the euro symbol, so what I do is:
>price<-price[grepl("€",price)]
But what I obtain is:
> price
character(0)
Because It did not recognize the euro symbol. If I create a vector which contains the euro symbol and I use the function grepl, It works!, but If I tried directly from the scrapping it does not work.
Question
What should I do to make the "grepl" function recognizes this symbol directly from scraping?
Result:
The result must to be something like this:
> price
[1] "198.500€" "198.500€" "6.000.000€" "6.000.000€" "1.800.000€"
[6] "1.800.000€" "Ha bajado 100.000€" "690.000€" "690.000€" "Ha bajado 410.000€"
[11] "2.450.000€" "2.450.000€" "Ha bajado 450.000€" "1.350.000€" "1.350.000€"
[16] "1.200.000€" "1.200.000€" "2.275.000€" "2.275.000€" "2.200.000€"
[21] "2.200.000€" "540.000€" "540.000€" "975.000€" "975.000€"
[26] "3.750.000€" "3.750.000€" "1.100.000€" "1.100.000€" "1.800.000€"
We can use the unicode
res <- price[grepl("\u20AC",price, perl = TRUE)]
length(res)
#[1] 91
as the OP's code gives
any(grepl("€",price))
#[1] FALSE
Related
I want to split the following character string from a chess game into separate strings like the ones below removing the "1-9." pattern while maintaining all the other text.
Example:
text <- "1. e4 e5 2. Nf3 Nf6 3. Nxe5 d6 4. Nd3 Nxe4 5. Qe2 Qe7 6. Nf4 Nf6 7. d4 Nc6 8. c3 d5 9. Nd2 Nd8 10. Nf3 Qxe2+ 11. Bxe2 Bd6 12. O-O O-O 13. Bd3 Re8 14. Re1 Rxe1+ 15. Nxe1 Ne6 16. Nxe6 Bxe6 17. g3 g6 18. Ng2 Re8 19. f3 Nh5 20. Kf2 c6 21. g4 Ng7 22. Bf4 Bxf4 23. Nxf4 g5 24. Ne2 f5 25. h3 Kf7 26. Rh1 h6 27. f4 fxg4 28. hxg4 Bxg4 29. Rxh6 Bf5 30. Bxf5 Nxf5 31. Rh7+ Ng7 32. fxg5 Kg6 33. Rh3 Kxg5 34. Rg3+ Kf6 35. Rf3+ Ke7 36. Nf4 Kd6 37. Ng6 Re6 38. Ne5 Ne8 39. Rf7 Rf6+ 40. Rxf6+ Nxf6 41. Ke3"
Desired result:
text_outcome <- c("e4", "e5", "Nf3", "Nf6", ..., "0-0", "Rg3+",)
So far I've tried:
text_outcome <- strsplit(text, "[^1-9.a-zA-Z]")[[1]] |>
as.data.frame() |>
mutate(text_cleaned = case_when(text_outcome == "O" ~ "O-O",
TRUE ~ text_outcome),
text_cleaned2 = str_replace_all(text_cleaned, "^[1-9].", " ")) |>
filter(!text_cleaned2 == "")
obtaining:
[5] "Nf3" "Nf6" " " "Nxe5"
[9] "d6" " " "Nd3" "Nxe4"
[13] " " "Qe2" "Qe7" " "
[17] "Nf4" "Nf6" " " "d4"
[21] "Nc6" " " "c3" "d5"
[25] " " "Nd2" "Nd8" "1"
[29] "." "Nf3" "Qxe2" " ."
[33] "Bxe2" "Bd6" " ." "O-O"
[37] "O-O" "O-O" "O-O" " ."
[41] "Bd3" "Re8" " ." "Re1"
[45] "Rxe1" " ." "Nxe1" "Ne6"
[49] " ." "Nxe6" "Bxe6" " ."
[53] "g3" "g6" " ." "Ng2"
[57] "Re8" " ." "f3" "Nh5"
[61] "2" "." "Kf2" "c6"
[65] " ." "g4" "Ng7" " ."
[69] "Bf4" "Bxf4" " ." "Nxf4"
[73] "g5" " ." "Ne2" "f5"
[77] " ." "h3" "Kf7" " ."
[81] "Rh1" "h6" " ." "f4"
[85] "fxg4" " ." "hxg4" "Bxg4"
[89] " ." "Rxh6" "Bf5" "3"
[93] "." "Bxf5" "Nxf5" " ."
[97] "Rh7" "Ng7" " ." "fxg5"
[101] "Kg6" " ." "Rh3" "Kxg5"
[105] " ." "Rg3" "Kf6" " ."
[109] "Rf3" "Ke7" " ." "Nf4"
[113] "Kd6" " ." "Ng6" "Re6"
[117] " ." "Ne5" "Ne8" " ."
[121] "Rf7" "Rf6" "4" "."
[125] "Rxf6" "Nxf6" " ." "Ke3"```
I'm sure there's a cleaner way to obtain this while removing the "0-0" duplicates and maintaining the "+" symbols such as Rf3+.
Thanks in advance,
Using str_extract
library(stringr)
str_extract_all(text, "[A-Za-z]\\S+")[[1]]
[1] "e4" "e5" "Nf3" "Nf6" "Nxe5" "d6" "Nd3" "Nxe4" "Qe2" "Qe7" "Nf4" "Nf6" "d4" "Nc6" "c3" "d5" "Nd2" "Nd8" "Nf3" "Qxe2+"
[21] "Bxe2" "Bd6" "O-O" "O-O" "Bd3" "Re8" "Re1" "Rxe1+" "Nxe1" "Ne6" "Nxe6" "Bxe6" "g3" "g6" "Ng2" "Re8" "f3" "Nh5" "Kf2" "c6"
[41] "g4" "Ng7" "Bf4" "Bxf4" "Nxf4" "g5" "Ne2" "f5" "h3" "Kf7" "Rh1" "h6" "f4" "fxg4" "hxg4" "Bxg4" "Rxh6" "Bf5" "Bxf5" "Nxf5"
[61] "Rh7+" "Ng7" "fxg5" "Kg6" "Rh3" "Kxg5" "Rg3+" "Kf6" "Rf3+" "Ke7" "Nf4" "Kd6" "Ng6" "Re6" "Ne5" "Ne8" "Rf7" "Rf6+" "Rxf6+" "Nxf6"
[81] "Ke3"
library(stringr)
x <- str_remove_all(unlist(str_split(text, ' ')), '\\d+\\.')
x[x != ""]
[1] "e4" "e5" "Nf3" "Nf6" "Nxe5" "d6" "Nd3"
[8] "Nxe4" "Qe2" "Qe7" "Nf4" "Nf6" "d4" "Nc6"
[15] "c3" "d5" "Nd2" "Nd8" "Nf3" "Qxe2+" "Bxe2"
[22] "Bd6" "O-O" "O-O" "Bd3" "Re8" "Re1" "Rxe1+"
[29] "Nxe1" "Ne6" "Nxe6" "Bxe6" "g3" "g6" "Ng2"
[36] "Re8" "f3" "Nh5" "Kf2" "c6" "g4" "Ng7"
[43] "Bf4" "Bxf4" "Nxf4" "g5" "Ne2" "f5" "h3"
[50] "Kf7" "Rh1" "h6" "f4" "fxg4" "hxg4" "Bxg4"
[57] "Rxh6" "Bf5" "Bxf5" "Nxf5" "Rh7+" "Ng7" "fxg5"
[64] "Kg6" "Rh3" "Kxg5" "Rg3+" "Kf6" "Rf3+" "Ke7"
[71] "Nf4" "Kd6" "Ng6" "Re6" "Ne5" "Ne8" "Rf7"
[78] "Rf6+" "Rxf6+" "Nxf6" "Ke3"
You can do:
library(stringr)
unlist(str_split(str_remove_all(text, '\\d{1,}\\. '), ' '))
[1] "e4" "e5" "Nf3" "Nf6" "Nxe5" "d6" "Nd3" "Nxe4" "Qe2"
[10] "Qe7" "Nf4" "Nf6" "d4" "Nc6" "c3" "d5" "Nd2" "Nd8"
[19] "Nf3" "Qxe2+" "Bxe2" "Bd6" "O-O" "O-O" "Bd3" "Re8" "Re1"
[28] "Rxe1+" "Nxe1" "Ne6" "Nxe6" "Bxe6" "g3" "g6" "Ng2" "Re8"
[37] "f3" "Nh5" "Kf2" "c6" "g4" "Ng7" "Bf4" "Bxf4" "Nxf4"
[46] "g5" "Ne2" "f5" "h3" "Kf7" "Rh1" "h6" "f4" "fxg4"
[55] "hxg4" "Bxg4" "Rxh6" "Bf5" "Bxf5" "Nxf5" "Rh7+" "Ng7" "fxg5"
[64] "Kg6" "Rh3" "Kxg5" "Rg3+" "Kf6" "Rf3+" "Ke7" "Nf4" "Kd6"
[73] "Ng6" "Re6" "Ne5" "Ne8" "Rf7" "Rf6+" "Rxf6+" "Nxf6" "Ke3"
In base R:
text |> gsub(pattern = '\\d+\\.\\s+', replacement = '') |>
strsplit(' ') |> unlist()
[1] "e4" "e5" "Nf3" "Nf6" "Nxe5" "d6" "Nd3" "Nxe4" "Qe2"
[10] "Qe7" "Nf4" "Nf6" "d4" "Nc6" "c3" "d5" "Nd2" "Nd8"
[19] "Nf3" "Qxe2+" "Bxe2" "Bd6" "O-O" "O-O" "Bd3" "Re8" "Re1"
[28] "Rxe1+" "Nxe1" "Ne6" "Nxe6" "Bxe6" "g3" "g6" "Ng2" "Re8"
[37] "f3" "Nh5" "Kf2" "c6" "g4" "Ng7" "Bf4" "Bxf4" "Nxf4"
[46] "g5" "Ne2" "f5" "h3" "Kf7" "Rh1" "h6" "f4" "fxg4"
[55] "hxg4" "Bxg4" "Rxh6" "Bf5" "Bxf5" "Nxf5" "Rh7+" "Ng7" "fxg5"
[64] "Kg6" "Rh3" "Kxg5" "Rg3+" "Kf6" "Rf3+" "Ke7" "Nf4" "Kd6"
[73] "Ng6" "Re6" "Ne5" "Ne8" "Rf7" "Rf6+" "Rxf6+" "Nxf6" "Ke3"
I just generated a large netcdf file from WRF modeling. The file has 143 variables, 122 global attributes and 9 dimension. It covers a 7-day period with a time step of 6 hours. All I wanted to do is to cut out and discard everything for the first day (first 4 time steps) and keep the rest of files. I searched for transNcdfCutFiles function within the ncdf.tools package but was a bit confused at how to properly use it.
I am new to NetCDF processing by R. Any suggestions or help are greatly appreciated!
I could not attached the file as it is pretty large, but here is a list of the variables. Thanks in advance.
names(ncin$var)
[1] "Times" "XLAT"
[3] "XLONG" "LU_INDEX"
[5] "ZNU" "ZNW"
[7] "ZS" "DZS"
[9] "VAR_SSO" "U"
[11] "V" "W"
[13] "PH" "PHB"
[15] "T" "HFX_FORCE"
[17] "LH_FORCE" "TSK_FORCE"
[19] "HFX_FORCE_TEND" "LH_FORCE_TEND"
[21] "TSK_FORCE_TEND" "MU"
[23] "MUB" "NEST_POS"
[25] "P" "PB"
[27] "FNM" "FNP"
[29] "RDNW" "RDN"
[31] "DNW" "DN"
[33] "CFN" "CFN1"
[35] "THIS_IS_AN_IDEAL_RUN" "P_HYD"
[37] "Q2" "T2"
[39] "TH2" "PSFC"
[41] "U10" "V10"
[43] "RDX" "RDY"
[45] "RESM" "ZETATOP"
[47] "CF1" "CF2"
[49] "CF3" "ITIMESTEP"
[51] "XTIME" "QVAPOR"
[53] "QCLOUD" "QRAIN"
[55] "SHDMAX" "SHDMIN"
[57] "SNOALB" "TSLB"
[59] "SMOIS" "SH2O"
[61] "SMCREL" "SEAICE"
[63] "XICEM" "SFROFF"
[65] "UDROFF" "IVGTYP"
[67] "ISLTYP" "VEGFRA"
[69] "GRDFLX" "ACGRDFLX"
[71] "ACSNOM" "SNOW"
[73] "SNOWH" "CANWAT"
[75] "SSTSK" "COSZEN"
[77] "LAI" "VAR"
[79] "MAPFAC_M" "MAPFAC_U"
[81] "MAPFAC_V" "MAPFAC_MX"
[83] "MAPFAC_MY" "MAPFAC_UX"
[85] "MAPFAC_UY" "MAPFAC_VX"
[87] "MF_VX_INV" "MAPFAC_VY"
[89] "F" "E"
[91] "SINALPHA" "COSALPHA"
[93] "HGT" "TSK"
[95] "P_TOP" "T00"
[97] "P00" "TLP"
[99] "TISO" "TLP_STRAT"
[101] "P_STRAT" "MAX_MSTFX"
[103] "MAX_MSTFY" "RAINC"
[105] "RAINSH" "RAINNC"
[107] "SNOWNC" "GRAUPELNC"
[109] "HAILNC" "CLDFRA"
[111] "SWDOWN" "GLW"
[113] "SWNORM" "OLR"
[115] "XLAT_U" "XLONG_U"
[117] "XLAT_V" "XLONG_V"
[119] "ALBEDO" "CLAT"
[121] "ALBBCK" "EMISS"
[123] "NOAHRES" "TMN"
[125] "XLAND" "UST"
[127] "PBLH" "HFX"
[129] "QFX" "LH"
[131] "ACHFX" "ACLHF"
[133] "SNOWC" "SR"
[135] "SAVE_TOPO_FROM_REAL" "HFX_FDDA"
[137] "ISEEDARR_RAND_PERTURB" "ISEEDARR_SPPT"
[139] "ISEEDARR_SKEBS" "LANDMASK"
[141] "LAKEMASK" "SST"
[143] "SST_INPUT"
This is much easier to do from the command line using cdo :
cdo seltimestep,5/nsteps ifile ofile
where nsteps is the number of timesteps in the file.
Consider the following code.
library(data.table)
data1x <- "x row1
1 1
1 2
1 3
1 4
2 1
2 2
2 3
3 1
4 2"
data1 <- read.table(textConnection(data1x), header=TRUE)
setDT(data1)
data1[, seqN := 1:.N, by="x"]
I want to do similar thing on h2o data frame. I went through the user manual, but am not able to figure out how to do this using h20.
EDIT : I tried the below code, for h2o, but it is giving error :
library(h2o)
h2o.init()
data1x <- "x row1
1 1
1 2
1 3
1 4
2 1
2 2
2 3
3 1
4 2"
data1x <- read.table(textConnection(data1x), header=TRUE)
data1xH2O <- as.h2o(data1x)
fun = function(df) {
1:nrow(df)
}
h2o.ddply(data1xH2O, "x", fun)
This results in following error :
ERROR: Unexpected HTTP Status code: 400 Bad Request (url = http://localhost:54321/99/Rapids)
water.rapids.Rapids.IllegalASTException
[1] "water.rapids.Rapids$IllegalASTException: Missing a number"
[2] " water.rapids.Rapids.number(Rapids.java:312)"
[3] " water.rapids.Rapids.parseNumList(Rapids.java:243)"
[4] " water.rapids.Rapids.parseList(Rapids.java:208)"
[5] " water.rapids.Rapids.parseNext(Rapids.java:140)"
[6] " water.rapids.Rapids.parseFunctionDefinition(Rapids.java:193)"
[7] " water.rapids.Rapids.parseNext(Rapids.java:139)"
[8] " water.rapids.Rapids.parseFunctionApplication(Rapids.java:158)"
[9] " water.rapids.Rapids.parseNext(Rapids.java:138)"
[10] " water.rapids.Rapids.parseFunctionApplication(Rapids.java:158)"
[11] " water.rapids.Rapids.parseNext(Rapids.java:138)"
[12] " water.rapids.Rapids.parse(Rapids.java:48)"
[13] " water.rapids.Rapids.exec(Rapids.java:81)"
[14] " water.api.RapidsHandler.exec(RapidsHandler.java:39)"
[15] " sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)"
[16] " sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)"
[17] " sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
[18] " java.lang.reflect.Method.invoke(Method.java:483)"
[19] " water.api.Handler.handle(Handler.java:61)"
[20] " water.api.RequestServer.serve(RequestServer.java:412)"
[21] " water.api.RequestServer.doGeneric(RequestServer.java:263)"
[22] " water.api.RequestServer.doPost(RequestServer.java:200)"
[23] " javax.servlet.http.HttpServlet.service(HttpServlet.java:755)"
[24] " javax.servlet.http.HttpServlet.service(HttpServlet.java:848)"
[25] " org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)"
[26] " org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)"
[27] " org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)"
[28] " org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)"
[29] " org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)"
[30] " org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)"
[31] " org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)"
[32] " org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)"
[33] " org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)"
[34] " org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)"
[35] " org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)"
[36] " org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)"
[37] " org.eclipse.jetty.server.Server.handle(Server.java:370)"
[38] " org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)"
[39] " org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)"
[40] " org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)"
[41] " org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)"
[42] " org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)"
[43] " org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)"
[44] " org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)"
[45] " org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)"
[46] " org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)"
[47] " org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)"
[48] " java.lang.Thread.run(Thread.java:745)"
Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page, :
ERROR MESSAGE:
Missing a number
Any suggestion, what I can do to remove this error.
I did not see this question first however in the following answer fun1 and fun2 are creating the same sequence based on column name you choose.
How to use : function in H2O ddply, R?
is that you are looking for?
I'm fairly new to R and I'm trying Phylogenetic Generalised Least Squares (PGLS) for the first time, using the addon package 'caper'. My phylogeny consists of 125 species. I'm getting an error when I read in the phylogeny that I created in Mesquite software (saved as a Nexus file):
##reading in my phylogeny
reptilephylogeny <- read.nexus ("reptile_phylogeny_new_edit.nex", tree.names = NULL)
##it gives me the following warning message:
Warning message:
In matrix(x, ncol = 2, byrow = TRUE) :
data length [253] is not a sub-multiple or multiple of the number of rows [127]
##So I checked how R is treating the tip labels:
reptilephylogeny$tip.label
[1] "Apalone_spinifera" "Staurotypus_triporcatus"
[3] "Gehyra_variegata" "Egernia_whitii"
[5] "Ameiva_erythrocephala" "Lacerta_vivipara"
[7] "Lacerta_agilis" "Podarcis_muralis"
[9] "Podarcis_sicula" "Psammodromus_algirus"
[11] "Tropidurus_itambere" "Tropidurus_torquatus"
[13] "Cyclura_nubila" "Ctenosaura_bakeri"
[15] "Uta_stansburiana" "Sceloporus_graciosus"
[17] "Sceloporus_scalaris" "Sceloporus_jarrovi"
[19] "19" "20"
[21] "21" "22"
[23] "23" "24"
[25] "25" "26"
[27] "27" "28"
[29] "29" "30"
[31] "31" "32"
[33] "33" "34"
[35] "35" "36"
[37] "37" "38"
[39] "39" "40"
[41] "41" "42"
[43] "43" "44"
[45] "45" "46"
[47] "47" "48"
[49] "49" "50"
[51] "51" ""
[53] "Basiliscus_vittatus" "Emoia_atrocostata"
[55] "Lygosoma_laterale" "Tropidurus_albemarlensis"
[57] "Tropidurus_semitaeniatus" "Varanus_bengalensis"
[59] "Intellagama_lesueurii" "Alligator_mississippiensis"
[61] "Caiman_latirostris" "Caiman_crocodilus"
[63] "Caiman_yacare" "Caretta_caretta"
[65] "Carettochelys_insculpta" "Chelodina_longicollis"
[67] "Chelonia_mydas" "Chelydra_serpentina"
[69] "Chrysemys_dorsalis" "Chrysemys_picta"
[71] "Clemmys_guttata" "Crocodylus_acutus"
[73] "Crocodylus_moreletii" "Crocodylus_johnstoni"
[75] "Crocodylus_niloticus" "Crocodylus_porosus"
[77] "Crocodylus_palustris" "Crotalus_horridus"
[79] "Cuora_flavomarginata" "Deirochelys_reticularia"
[81] "Dermatemys_mawii" "Emydoidea_blandingii"
[83] "Emydura_macquarii" "Emys_orbicularis"
[85] "Eretmochelys_imbricata" "Gopherus_agassizii"
[87] "Gopherus_berlandieri" "n86"
[89] "n87" "n88"
[91] "n89" "n90"
[93] "n91" "n92"
[95] "n93" "n94"
[97] "n95" "n96"
[99] "n97" "n98"
[101] "n99" "n100"
[103] "n101" "n102"
[105] "n103" "n104"
[107] "n105" "n106"
[109] "n107" "n108"
[111] "n109" "n110"
[113] "n111" "n112"
[115] "n113" "n114"
[117] "n115" "n116"
[119] "n117" "n118"
[121] "n119" "n120"
[123] "n121" "n122"
[125] "n123" "n124"
[127] "1"
It seems as though R isn't filling the data rows/columns consistently - in my species list, there are no gaps between each species, yet clearly here R thinks there are spaces (in this case numbers) between the species names. Does anyone have an idea of why this might be happening?
Thanks,
Greg
I am developing a GNU Make file to allow me to compile all my LaTeX documents using a single command. To date I've been specifying the target on the command line but am tired of it.
My LaTex files are stored in a subfolder of the folder where I keep my PDF files.
My script is able to assemble the lists I need, but the code for the target and its rule list only processes the first LaTeX file found. I've been searching for hours now for an explanation on how to iterate through my file list in the target/rule section. My script is below:
rwildcard=${foreach d,${wildcard $1*},${call rwildcard,$d/,$2} ${filter ${subst *,%,$2},$d}}
# Sub-folder containing my LaTeX files
TEX_DIR=TeX
# Build a list of LaTeX files with the relative path included
TEX_SRCS_IN = ${call rwildcard, ${TEX_DIR}/, *.tex}
# Build a list of LaTeX files w/o paths
TEX_SRCS = $(TEX_SRCS_IN:$(TEX_DIR)/%=%)
# Build a list of PDF files that need to be generated
TEX_PDF_IN = ${foreach a, ${TEX_IN}, ${a:.tex=.pdf}}
# Then remove the path information
TEX_PDF = $(TEX_PDFIN:$(TEX_DIR)/%=%)
.PHONY: all
all: ${TEX_PDF}
${TEX_PDF} : ${TEX_SRCS_IN}
clear && \
echo "Input List=${TEX_SRCS_IN}" && \
echo "LaTeX Files=${TEX_SRCS}" && \
echo "PDFs=${TEX_PDF}" && \
cd ${TEX_DIR} && \
pdflatex ${TEX_SRCS} && \
cd ../ && \
mv $(TEX_DIR)/${TEX_PDF} .
I tried using a $(foreach doc,$(TEX_SRCS),pdflatex $(doc) && ) for the pdflatex processor and a similar statement for the move command, perhaps I didn't get the formatting right?
Below is the output I get from running the above. As can be seen, there are 6 files and the make file always makes the first file (GettingStarted.tex) but none of the rest.
If I remove the lines:
.PHONY: all
all: ${TEX_PDF}
then, once the first file is made, if it's up to date, the script tells me so and stops.
user#mars:~/Desktop/Project/Docs$ make -f Makefile
clear && \
echo "Input List= TeX/GettingStarted.tex TeX/GettingStarted_inst_Project_usb_Bridge.tex TeX/GettingToUse.tex TeX/DriverGettingStarted.tex TeX/RaspberryPiGettingStarted.tex TeX/instGettingStarted.tex" && \
echo "LaTeX Files=GettingStarted.tex GettingStarted_inst_Project_usb_Bridge.tex GettingToUse.tex DriverGettingStarted.tex RaspberryPiGettingStarted.tex instGettingStarted.tex" && \
echo "PDFs=GettingStarted.pdf GettingStarted_inst_Project_usb_Bridge.pdf GettingToUse.pdf DriverGettingStarted.pdf RaspberryPiGettingStarted.pdf instGettingStarted.pdf" && \
cd TeX && \
pdflatex GettingStarted.tex GettingStarted_inst_Project_usb_Bridge.tex GettingToUse.tex DriverGettingStarted.tex RaspberryPiGettingStarted.tex instGettingStarted.tex && \
cd ../ && \
mv TeX/GettingStarted.pdf GettingStarted_inst_Project_usb_Bridge.pdf GettingToUse.pdf DriverGettingStarted.pdf RaspberryPiGettingStarted.pdf instGettingStarted.pdf .
Input List= TeX/GettingStarted.tex TeX/GettingStarted_inst_Project_usb_Bridge.tex TeX/GettingToUse.tex TeX/DriverGettingStarted.tex TeX/RaspberryPiGettingStarted.tex TeX/instGettingStarted.tex
LaTeX Files=GettingStarted.tex GettingStarted_inst_Project_usb_Bridge.tex GettingToUse.tex DriverGettingStarted.tex RaspberryPiGettingStarted.tex instGettingStarted.tex
PDFs=GettingStarted.pdf GettingStarted_inst_Project_usb_Bridge.pdf GettingToUse.pdf DriverGettingStarted.pdf RaspberryPiGettingStarted.pdf instGettingStarted.pdf
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
restricted \write18 enabled.
entering extended mode
(./GettingStarted.tex
LaTeX2e <2011/06/27>
Babel <3.9f> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (./FillAFour.sty)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/color.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)))
(/usr/share/texlive/texmf-dist/tex/latex/base/alltt.sty)
(/usr/share/texlive/texmf-dist/tex/latex/upquote/upquote.sty)
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def))
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
Package hyperref Warning: Option `a4paper' is no longer used.
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/backref.sty
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty)))
Package hyperref Message: Driver: hpdftex.
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def)
(./GettingStarted.aux)
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./GettingStarted.out) (./GettingStarted.out)
(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd)
(/usr/share/texlive/texmf-dist/tex/latex/base/t1cmtt.fd) (./GettingStarted.toc
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]) [2]
Overfull \hbox (26.10161pt too wide) in paragraph at lines 207--207
\T1/cmtt/m/n/10 sudo apt-get install libavahi-cil-dev libavahi-compat-libdnssd1
python-dev libicu-dev
[25] [26] [27] [28] [29] [30] (./GettingStarted.aux) )
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 ecbi1200
mktexpk: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1+0/600; nonstopmode; input ecbi1200
This is METAFONT, Version 2.718281 (TeX Live 2013/Debian)
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/ecbi1200.mf
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exbase.mf)
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/ecbi.mf
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/extextit.mf
Ok (/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exaccess.mf
Ok) (/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/expseudo.mf
Ok) (/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exileast.mf
Ok [158] [160] [161] [162] [163] [164] [165] [166] [167] [168] [169] [170]
[171] [172] [173] [174] [175] [176] [177] [178] [179] [180] [181] [182]
[183] [184] [185] [186] [187] [188])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exilwest.mf
Ok [224] [225] [226] [227] [228] [229] [230] [231] [232] [233] [234] [235]
[236] [237] [238] [239] [240] [241] [242] [243] [244] [245] [246] [247]
[248] [249] [250] [251] [252] [253] [254] [255])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exruwest.mf
Ok [192] [193] [194] [195] [196] [197] [198] [199] [200] [201] [202] [203]
[204] [205] [206] [207] [208] [209] [210] [211] [212] [213] [214] [215]
[216] [217] [218] [219] [220] [221] [222] [223])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrueast.mf
Ok [128] [129] [130] [131] [132] [133] [134] [135] [136] [137] [138] [139]
[140] [141] [142] [143] [144] [145] [146] [147] [148] [149] [150] [151]
[152] [153] [154] [155] [156] [157])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exbraces.mf
Ok [94] [126] [23] [40] [41] [60] [124] [62] [91] [93] [92] [123] [125]
[95] [127] [32])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/expunct.mf
Ok [14] [15] [19] [20] [13] [18] [33] [39] [42] [43] [44] [46] [47] [58]
[59] [61] [96] [189] [17] [45] [16] [21] [22])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exaccent.mf
Ok [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exsign.mf
Ok [24] [34] [35] [36] [37] [64] [191] [159])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exilig.mf
Ok [25] [26] [27] [28] [29] [30] [31])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exitalp.mf
Ok [38] [63] [190])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrulett.mf
Ok [65] [66] [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78]
[79] [80] [81] [82] [83] [84] [85] [86] [87] [88] [89] [90])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exillett.mf
Ok [97] [98] [99] [100] [101] [102] [103] [104] [105] [106] [107] [108]
[109] [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120]
[121] [122])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exidigit.mf
Ok [48] [49] [50] [51] [52] [53] [54] [55] [56] [57])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exiligtb.mf
Ok) ) ) )
(some charht values had to be adjusted by as much as 0.09164pt)
Font metrics written on ecbi1200.tfm.
Output written on ecbi1200.600gf (256 characters, 62216 bytes).
Transcript written on ecbi1200.log.
mktexpk: /tmp/texfonts/pk/ljfour/jkuserpen/ec/ecbi1200.600pk: successfully generated.
(see the transcript file for additional information) </tmp/texfonts/pk/ljfour/j
kuserpen/ec/ecbi1200.600pk>
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 0+525/600 --dpi 525 ectt0800
mktexpk: Running mf-nowin -progname=mf \mode:=ljfour; mag:=0+525/600; nonstopmode; input ectt0800
This is METAFONT, Version 2.718281 (TeX Live 2013/Debian)
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/ecrm1200.mf
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exbase.mf)
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/ecrm.mf
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exroman.mf
Ok (/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exaccess.mf
Ok) (/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/expseudo.mf
Ok) (/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exruwest.mf
Ok [192] [193] [194] [195] [196] [197] [198] [199] [200] [201] [202] [203]
[204] [205] [206] [207] [208] [209] [210] [211] [212] [213] [214] [215]
[216] [217] [218] [219] [220] [221] [222] [223])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrlwest.mf
Ok [224] [225] [226] [227] [228] [229] [230] [231] [232] [233] [234] [235]
[236] [237] [238] [239] [240] [241] [242] [243] [244] [245] [246] [247]
[248] [249] [250] [251] [252] [253] [254] [255])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrueast.mf
Ok [128] [129] [130] [131] [132] [133] [134] [135] [136] [137] [138] [139]
[140] [141] [142] [143] [144] [145] [146] [147] [148] [149] [150] [151]
[152] [153] [154] [155] [156] [157])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrleast.mf
Ok [158] [160] [161] [162] [163] [164] [165] [166] [167] [168] [169] [170]
[171] [172] [173] [174] [175] [176] [177] [178] [179] [180] [181] [182]
[183] [184] [185] [186] [187] [188])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exbraces.mf
Ok [94] [126] [23] [40] [41] [60] [124] [62] [91] [93] [92] [123] [125]
[95] [127] [32])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/expunct.mf
Ok [14] [15] [19] [20] [13] [18] [33] [39] [42] [43] [44] [46] [47] [58]
[59] [61] [96] [189] [17] [45] [16] [21] [22])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exaccent.mf
Ok [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exsign.mf
Ok [24] [34] [35] [36] [37] [64] [191] [159])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrlig.mf
Ok [25] [26] [28] [27] [29] [30] [31])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exromp.mf
Ok [38] [63] [190])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrulett.mf
Ok [65] [66] [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78]
[79] [80] [81] [82] [83] [84] [85] [86] [87] [88] [89] [90])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrllett.mf
Ok [97] [98] [99] [100] [101] [102] [103] [104] [105] [106] [107] [108]
[109] [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120]
[121] [122])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrdigit.mf
Ok [48] [49] [50] [51] [52] [53] [54] [55] [56] [57])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrligtb.mf
Ok) ) ) )
(some charht values had to be adjusted by as much as 0.07143pt)
Font metrics written on ecrm1200.tfm.
Output written on ecrm1200.600gf (256 characters, 60320 bytes).
Transcript written on ecrm1200.log.
mktexpk: /tmp/texfonts/pk/ljfour/jkuserpen/ec/ecrm1200.600pk: successfully generated.
</tmp/texfonts/pk/ljfour/jkuserpen/ec/ecrm1200.600pk>
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 ecrm1728
mktexpk: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1+0/600; nonstopmode; input ecrm1728
This is METAFONT, Version 2.718281 (TeX Live 2013/Debian)
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/ecrm1728.mf
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exbase.mf)
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/ecrm.mf
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exroman.mf
Ok (/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exaccess.mf
Ok) (/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/expseudo.mf
Ok) (/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exruwest.mf
Ok [192] [193] [194] [195] [196] [197] [198] [199] [200] [201] [202] [203]
[204] [205] [206] [207] [208] [209] [210] [211] [212] [213] [214] [215]
[216] [217] [218] [219] [220] [221] [222] [223])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrlwest.mf
Ok [224] [225] [226] [227] [228] [229] [230] [231] [232] [233] [234] [235]
[236] [237] [238] [239] [240] [241] [242] [243] [244] [245] [246] [247]
[248] [249] [250] [251] [252] [253] [254] [255])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrueast.mf
Ok [128] [129] [130] [131] [132] [133] [134] [135] [136] [137] [138] [139]
[140] [141] [142] [143] [144] [145] [146] [147] [148] [149] [150] [151]
[152] [153] [154] [155] [156] [157])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrleast.mf
Ok [158] [160] [161] [162] [163] [164] [165] [166] [167] [168] [169] [170]
[171] [172] [173] [174] [175] [176] [177] [178] [179] [180] [181] [182]
[183] [184] [185] [186] [187] [188])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exbraces.mf
Ok [94] [126] [23] [40] [41] [60] [124] [62] [91] [93] [92] [123] [125]
[95] [127] [32])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/expunct.mf
Ok [14] [15] [19] [20] [13] [18] [33] [39] [42] [43] [44] [46] [47] [58]
[59] [61] [96] [189] [17] [45] [16] [21] [22])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exaccent.mf
Ok [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exsign.mf
Ok [24] [34] [35] [36] [37] [64] [191] [159])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrlig.mf
Ok [25] [26] [28] [27] [29] [30] [31])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exromp.mf
Ok [38] [63] [190])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrulett.mf
Ok [65] [66] [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78]
[79] [80] [81] [82] [83] [84] [85] [86] [87] [88] [89] [90])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrllett.mf
Ok [97] [98] [99] [100] [101] [102] [103] [104] [105] [106] [107] [108]
[109] [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120]
[121] [122])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrdigit.mf
Ok [48] [49] [50] [51] [52] [53] [54] [55] [56] [57])
(/usr/share/texlive/texmf-dist/fonts/source/jkuserpen/ec/exrligtb.mf
Ok) ) ) )
(some charht values had to be adjusted by as much as 0.0972pt)
Font metrics written on ecrm1728.tfm.
Output written on ecrm1728.600gf (256 characters, 84608 bytes).
Transcript written on ecrm1728.log.
mktexpk: /tmp/texfonts/pk/ljfour/jkuserpen/ec/ecrm1728.600pk: successfully generated.
</tmp/texfonts/pk/lj
four/jkuserpen/ec/ecrm1728.600pk></usr/share/texlive/texmf-dist/fonts/type1/publ
ic/amsfonts/cm/cmmi10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/ams
fonts/cm/cmsy10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/
cm/cmsy9.pfb>
Output written on GettingStarted.pdf (30 pages, 282962 bytes).
Transcript written on GettingStarted.log.
mv: cannot stat ‘GettingStarted_inst_Project_usb_Bridge.pdf’: No such file or directory
mv: cannot stat ‘GettingToUse.pdf’: No such file or directory
mv: cannot stat ‘DriverGettingStarted.pdf’: No such file or directory
mv: cannot stat ‘RaspberryPiGettingStarted.pdf’: No such file or directory
mv: cannot stat ‘instGettingStarted.pdf’: No such file or directory
make: *** [GettingStarted_inst_Project_usb_Bridge.pdf] Error 1
user#mars:~/Desktop/Project/Docs$
Looks to me like the .PHONY: all all: ${TEX_PDF} lines aren't producing the behaviour I want, but the main problem for me is that still; only the first file is processed.
How do I make the target and its rule list iterate through the whole list of files?
UPDATED
Almost fixed now, The problem was with the dependencies of ${TEX_PDF}.
It's making all the files now, however the dependency calculation is not working correctly.
Removing ${TEX_IN} and leaving it blank, and changing the way the dependency is referenced inside the rule (using the target's name ($#) and substituting the extension) made it work for a one shot run.
Changing the dependency to $(TEX_DIR)/$(#:.pdf=.tex) causes it to make ALL the files each run.
I've added a line to clean up the pdflatex auto-generated files ( .out, .log, .toc, and .aux) as a convenience. It can be edited or removed if not required.
rwildcard=${foreach d,${wildcard $1*},${call rwildcard,$d/,$2} ${filter ${subst *,%,$2},$d}}
TEX_DIR=TeX # Sub-folder containing TEX files
TEX_SRCS_IN = ${call rwildcard, ${TEX_DIR}/, *.tex} # 'TEX' List with paths
TEX_PDF_IN = ${foreach a, ${TEX_SRCS_IN}, ${a:.tex=.pdf} } # 'PDF' List with paths
TEX_PDF = $(TEX_PDF_IN:$(TEX_DIR)/%=%) # 'PDF' List without paths
.PHONY: all
all: ${TEX_PDF}
${TEX_PDF} : $(TEX_DIR)/$(#:.pdf=.tex)
cd ${TEX_DIR} && \
pdflatex $(#:.pdf=.tex) && \
rm $(#:.pdf=.out) $(#:.pdf=.log) $(#:.pdf=.toc) $(#:.pdf=.aux) && \
cd ../ && \
mv $(TEX_DIR)/$# .
This is probably one of the top 3 most commonly asked questions about make. When you run make with no arguments it only builds the first target listed in the makefile. If you want it to build more than one target, you need to put a new target at the beginning of your makefile that depends on the other targets you want built.
So, add this line before the first target:
.PHONY: all
all: ${TEX_PDF}
ETA:
Only the first file is processed, because the end result of the processing the first file is a failure: make: *** [GettingStarted_inst_Project_usb_Bridge.pdf] Error 1. By default, make will stop after the first failure and won't build anything more. If you want it to keep going, you can run make -k.
But, I recommend you fix your failure, then it will continue.
The problem is the end of your rule, where you say:
mv $(TEX_DIR)/${TEX_PDF} .
TEX_PDF contains a list of files, so this expands to (as you can see from the output):
mv TeX/GettingStarted.pdf GettingStarted_inst_Project_usb_Bridge.pdf GettingToUse.pdf DriverGettingStarted.pdf RaspberryPiGettingStarted.pdf instGettingStarted.pdf .
which is obviously not what you want. You want to move just the one file that you're creating, which is given to you as an automatic variable $#.
Finally fixed. Working now as I intended it to.
Changed the target definition to the generic form %.pdf with dependency defined similarly but in a subfolder ${TEX_DIR}/%.tex. Added a target/rule for the dependency using a NO-OP command.
# Usage:
# From the ./Docs folder
#
# Scan the TeX folder and make all necessary PDF's
# make -f Makefile
#
# Make a specific TEX file
# make -f Makefile TEX_SRCS_IN=<filename>.tex
#
#
rwildcard=${foreach d,${wildcard $1*},${call rwildcard,$d/,$2} ${filter ${subst *,%,$2},$d}}
TEX_DIR=TeX # Sub-folder containing TEX files
TEX_SRCS_IN = ${call rwildcard, ${TEX_DIR}/, *.tex} # 'TEX' List with paths
TEX_PDF_IN = ${foreach a, ${TEX_SRCS_IN}, ${a:.tex=.pdf} } # 'PDF' List with paths
TEX_PDF = $(TEX_PDF_IN:$(TEX_DIR)/%=%) # 'PDF' List without paths
.PHONY: all
all: ${TEX_PDF}
%.pdf : ${TEX_DIR}/%.tex
cd ${TEX_DIR} && \
pdflatex $(#:.pdf=.tex) && \
rm $(#:.pdf=.out) $(#:.pdf=.log) $(#:.pdf=.toc) $(#:.pdf=.aux) && \
cd ../ && \
mv $(TEX_DIR)/$# .
${TEX_DIR}/%.tex:
#: